nkhatri
02/27/2025, 8:18 PMCeligo AI
02/27/2025, 8:18 PMAI generated answer (using internal Slack threads):It seems like you're having trouble with a Map/Reduce script that triggers a workflow using
workflow.trigger
, but it's not changing the state of the record in the workflow history.
Based on the conversations, it appears that the issue might be related to the context in which the scripts and workflows are running.
In NetSuite, User Event scripts and workflows are not triggered by other scripts by default. This is to prevent infinite loops and other potential issues. However, there are some exceptions. For example, a Map/Reduce script can trigger a User Event script unless the deployment is set up to not run in the Map/Reduce context.
If you're trying to trigger a workflow from a User Event script, it's important to note that this might not work as expected. Workflows are typically triggered by user actions or specific conditions on the record, not by scripts.
If you're updating a record using record.submitFields
, it's also important to note that this method does not trigger workflows or User Event scripts.
If you need to update a record and trigger a workflow from a script, you might need to use a different method, such as record.save
or N/record.submitRecord
, and make sure that the enableSourcing
option is set to true
.
Here's a code snippet that might help:
javascript
var record = record.load({
type: record.Type.SALES_ORDER,
id: '123'
});
record.setValue({
fieldId: 'custbody_some_field',
value: 'some value'
});
var recordId = record.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
Remember to replace '123'
, 'custbody_some_field'
, and 'some value'
with your actual record ID, field ID, and value.
******
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/27/2025, 8:19 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835044384
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816244
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812725723
Celigo AI
02/27/2025, 8:19 PM