Example of a suitescript search that returns relea...
# ask-stanley-ai
m
Example of a suitescript search that returns released work orders that passes the order number as a param and is filtered by it
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you are looking for a SuiteScript search that returns released work orders and is filtered by the order number passed as a parameter. Here is an example of how you might accomplish this:
Copy code
javascript
var search = require('N/search');

function getReleasedWorkOrders(orderNumber) {
    var workOrderSearch = search.create({
        type: search.Type.WORK_ORDER,
        filters: [
            ['status', search.Operator.ANYOF, 'WorkOrd:F'], // F is the internal id for Released status
            'AND',
            ['tranid', <http://search.Operator.IS|search.Operator.IS>, orderNumber]
        ],
        columns: ['tranid', 'status']
    });

    var resultSet = workOrderSearch.run();
    var results = resultSet.getRange({start: 0, end: 1000}); // adjust range as needed

    return results;
}
This script creates a search on the Work Order record type, filters for work orders with a status of 'Released' and a transaction id (order number) matching the passed parameter. It then runs the search and returns the results. Please note that you may need to adjust the range of the results based on your specific needs. Also, the internal id for the 'Released' status ('WorkOrd:F') is used in this example, you may need to adjust this based on your account setup. ****** 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.803399622
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.798501968
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.796812117
Please provide your feedback on this answer.