ANS-1050 · SUITESCRIPT DEVELOPMENT

How to Identify if a Record Submission Originates from a Specific SuiteScript Client Script?

Implement a temporary custom field to flag record submissions initiated by a SuiteScript Client (SSC) script, enabling server-side scripts to detect the origin.

Short answer

To determine if a record is submitted by a SuiteScript Client script, create a hidden, freeform text custom field with "Store Value" set to False. The client script populates this field before submission. A server-side User Event script can then read this temporary flag to identify the submission source. The field automatically clears after save.

Scenario

Organizations often need to differentiate between record submissions initiated manually by a user and those triggered programmatically by a SuiteScript Client (SSC) script. This distinction is crucial for server-side User Event (SUE) scripts that may need to behave differently based on the submission origin.

Solution

  1. Create a hidden custom field of type "Free-Form Text" on the relevant record. Ensure the "Store Value" checkbox for this custom field is set to False. This configuration ensures the field's value is not permanently saved to the database and automatically clears after the record is saved.

  2. Within the SuiteScript Client (SSC) script that is submitting the record, populate this newly created custom field with a specific identifier (e.g., the script's name or a unique flag) just before the record submission.

  3. A server-side User Event (SUE) script, configured to trigger on the same record, can then read the value of this custom field during its execution. By checking the field's content, the SUE script can determine if the record submission originated from the specific SSC script.

  4. Because the custom field's "Store Value" is set to False, its content will automatically be emptied after the record is successfully saved, making it a temporary flag for real-time detection without affecting stored data.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant