I have a 2.0 SuiteScript ClientScript that changes the value in a field based on a change to the value in another field, running off the fieldChanged event.
So, if the value in field XYZ is changed, I check its new value and set the value in field ABC accordingly.
I also have another field, DEF. If it’s value is changed, I check its new value and set the value in fields XYZ and ABC accordingly. Setting the value of fields XYZ and ABC, of course, fires the fieldChanged even for field XYZ, which changes the value of field ABC. But I don’t want that to happen in this instance – I set the value of field ABC based on DEF, and don’t want it reset based on XYZ.
So basically, if field XYZ is changed by user action, I want to set the value of the field ABC. But if field XYZ is changed by this script, I do not want to set the value of the field ABC.
I was hoping there was something in the currentRecord object that said the origin of the change, but there’s not. Is there any way I can determine how the change to field XYZ happened? Is there any way I can prevent the change to field XYZ prompting the change in the field ABC if XYZ was, itself, changed because of the change to DEF, rather than by user action?