To add the "Save to ERP" warning, navigate to the "Development" section in the operations portal.

Click "Interceptors". In order to access "Interceptors" the account will need to be set up either as an "administrator" or a "superuser", or have the appropriate role: "scriptEdit".

Scroll down the list to locate the "saveOrderToErpValidationManual.js" interceptor. This specific interceptor is executed just before an Order or Cash Quote is saved to the ERP.

Click the more details icon to open the editor screen. This opens the code editing interface where the validation rule will be added.

Locate the code block in the editor that outputs the warning string.

If the required code block is not present, insert the code block that performs the validation check directly into the editor.

Set the custom conditional statement to check a field's value against an input value.

Assign a custom string to the "validationError" variable. The string is displayed as "Save to ERP" warning message.

Click "Save" to save the code block to the interceptor.

To check if the code is working, navigate to "Orders" screen. In order to access and update "Orders", you will need to be set up either as an "administrator" or a "superuser", or have the role: "orderEdit".

Search for an order to test.

Click the icon to navigate to the details screen of the order.

Click on "More" to view the more tabs.

Click on the "Development" tab. In order to access this tab, you will need to have the role; "Developer".

Scroll down to locate the "extra1" field. Any data you input in this field will go through the conditional code block created earlier.

Type in the value that you set earlier in the interceptor. This sets the necessary condition to trigger the conditional statement and display the error warning on the screen. In this example, we used "TestException".

Now, click on the "Save to ERP" icon. This will execute the previously defined conditional code block.

If the condition in the code block is met or if the field value matches the assigned value, the ERP save process automatically stops, and the value assigned to the "validationError" variable is displayed as a warning message on screen.
