how to search a sales order with a custom body fie...
# ask-stanley-ai
m
how to search a sales order with a custom body field value of existing sales order using user event script
c
AI generated answer (using internal Slack threads):
To search a sales order with a custom body field value of an existing sales order using a user event script, you can use SuiteScript's search API. Here's a basic example of how you might do this:
Copy code
javascript
var filters = [];
filters.push(search.createFilter({
    name: 'custbody_your_custom_field', // replace with your custom field's internal id
    operator: <http://search.Operator.IS|search.Operator.IS>,
    values: 'your_value' // replace with the value you're searching for
}));

var columns = [];
columns.push(search.createColumn({
    name: 'tranid'
}));

var salesOrderSearch = search.create({
    type: search.Type.SALES_ORDER,
    filters: filters,
    columns: columns
});

salesOrderSearch.run().each(function(result) {
    // process each sales order that matches the search
    var salesOrderId = result.getValue(columns[0]);
    // do something with salesOrderId
    return true; // continue to next sales order
});
This script creates a search for sales orders where the custom body field has a certain value. It then runs the search and processes each matching sales order. Please replace
'custbody_your_custom_field'
with the internal id of your custom body field, and
'your_value'
with the value you're searching for. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830435455
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824302316
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822906077
Please provide your feedback on this answer.