Adam Weaver
02/07/2025, 7:56 PMCeligo AI
02/07/2025, 7:56 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems like the issue you're facing is related to the event in which your script is running. If you're trying to create a work order from a sales order using a User Event (UE) script in the AfterSubmit event, it might not trigger the automatic creation of the work order. This is because a User Event script cannot call another User Event script. To resolve this, you might want to move your logic to the BeforeSubmit event. In this event, you can add the item and check the "createwo" box, then let NetSuite handle the creation of the work order natively. Here's a general idea of what your script might look like:
javascript
function beforeSubmit(type) {
if (type == 'create' || type == 'edit') {
var record = nlapiGetNewRecord();
var lineCount = record.getLineItemCount('item');
for (var i = 1; i <= lineCount; i++) {
record.setLineItemValue('item', 'createwo', i, 'T');
}
}
}
This script will check the "createwo" box for each line item in the sales order before it's submitted, triggering the automatic creation of work orders.
******
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
02/07/2025, 7:57 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836528897
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828763306
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824948907
Celigo AI
02/07/2025, 7:57 PM