Hello, I have a ClientScript that runs on a Field...
# suitescript
s
Hello, I have a ClientScript that runs on a FieldChanged event against the Items sublist. I cannot seem to figure out how to stop the FieldChanged event from running after the line item values are set: 1. User selects the Item, and the FieldChanged event fires. 2. I then set the quantity, description, and amount for that line item It appears the FieldChanged event is being triggered for each value being set (quantity, desc, amount), which results in an additional line item being added to the bottom of the sublist ( populated with data from the above line item). What am I doing wrong? Any suggestions would be helpful.
Copy code
function fieldChanged(context) {

            //react to live sublist changes
          	if(sublistName == 'item' && sublistFieldName == 'item') {
                   //Set Line Item value

              		currentRecord.setCurrentSublistValue({
                          sublistId: sublistName,
                          fieldId: 'quantity',
                          value: 1,
                      	  ignoreFieldChange: true


                      });
                      currentRecord.setCurrentSublistValue({
                          sublistId: sublistName,
                          fieldId: 'description',
                          value: formula,
                          ignoreFieldChange: true

                      });

                     currentRecord.setCurrentSublistValue({
                          sublistId: sublistName,
                          fieldId: 'amount',
                          value: myCalc,
                          ignoreFieldChange: true

                      });
              		 currentRecord.commitLine({"sublistId": sublistName, ignoreRecalc: true});
  }
}