KM
06/11/2026, 8:18 AMCeligo AI
06/11/2026, 8:18 AMAI generated answer (using internal Slack threads):To set the status of a Sales Order to "Pending Fulfillment" using SuiteScript, you need to set the
orderstatus field to 'B'. Here is a sample code snippet that demonstrates how to do this:
javascript
define(['N/search', 'N/record', 'N/email', 'N/runtime'],
function(search, record, email, runtime) {
function execute(context) {
var searchId = 'customsearch4203';
try {
search.load({
id: searchId
}).run().each(function(result) {
log.debug('SO :' + result.id + 'type :'+ record.Type.SALES_ORDER );
record.submitFields({
type: record.Type.SALES_ORDER,
id: result.id,
values: {
orderstatus:'B'
}
});
return true;
});
} catch (e) {
log.debug('Exception :' + result.id + ' SO Not found');
}
}
return {
execute: execute
};
});
Please note that the field name is orderstatus and not orderStatus. The case is important in this context.
Also, if the status keeps reverting back to "Pending Approval", it might be due to a workflow or some other process that is changing it back. You might want to check if you have any Advanced Approval turned on under setup->Accounting->Accounting Settings->Approval Routing.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/11/2026, 8:18 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.861541808
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834350586
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830596924
Celigo AI
06/11/2026, 8:18 AM