Tiina Böös
05/08/2026, 10:46 AMCeligo AI
05/08/2026, 10:46 AMAI generated answer (using internal Slack threads):fieldChanged and postSourcing are two different types of event handlers in SuiteScript, NetSuite's JavaScript-based API. fieldChanged is an event that is triggered when a field value changes. This event is useful when you want to perform some action based on the change in a field's value. However, it's important to note that this event will fire for any field change, so you may want to add conditions to isolate the event to occur only when a specific field is changed. For example, you can check the field id before executing your logic. Also, be aware that calling
setValue inside a fieldChanged event will trigger the fieldChanged event again, potentially causing an infinite loop. To avoid this, you can use the ignoreFieldChange parameter of setValue.
code
function fieldChanged(scriptContext) {
if (scriptContext.fieldId === 'your_specific_field') {
// Your logic here
}
}
postSourcing is an event that is triggered after a field sourcing operation is complete. This event is useful when you want to perform some action after a field's value has been sourced from another record. For example, you might want to set another field's value based on the sourced value. However, be careful when calling setValue inside a postSourcing event, as it can also trigger the postSourcing event again, potentially causing an infinite loop. To avoid this, you can use the ignoreFieldChange parameter of setValue.
code
function postSourcing(scriptContext) {
if (scriptContext.fieldId === 'your_specific_field') {
var currentRecord = scriptContext.currentRecord;
currentRecord.setValue({
fieldId: 'another_field',
value: 'new_value',
ignoreFieldChange: true
});
}
}
******
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
05/08/2026, 10:47 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836242676
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832458496
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829711914
Celigo AI
05/08/2026, 10:47 AM