Is there a way to only have a script run when an item is UPDATED not CREATED? Or at least allow the item to be created and ignore the rest of the script if an error occurs?
v
varonaPTX
05/09/2022, 9:27 PM
You can check the context.type value that is passed to the script. (off the top of my head here.) Look in the SuiteScript 2.0 docs under the User Event script type and it will give full details on what is in the context parameters.
varonaPTX
05/09/2022, 9:28 PM
Once you know the type, you can branch on the code value whether to run or not.
If it's only needed for one event type, then you can also set it on the script deployment as Event Type and no code change would be required. If you need a conditional logic for more event types then go with varonaPTX's suggestion.
j
Jared Fraley
05/10/2022, 8:58 PM
For some reason setting an event type context filter broke the script, it does not run. I removed the context filter and it still does not run anymore. I had to delete the deployments and redeploy for it to work again. I figured out another solution, I just did a try catch