SuiteScript : Defaulting Tax Code at Line Level
Script Difficulty: 💚
Here is a time where you would like to set the tax code at the line level to select a certain tax. This is an alternative solution to demonstrate that you can consider scripting to implement at the line level. The solution also combined with a control point visible to the user for triggering of the script actions.
Exercise goal: for all Invoices, have a custom checkbox that controls the triggering of setting tax code to NoTax to every line and override the tax to zero at save.
Create a new custom checkbox and give it a good name, in our case it's Wipe Tax. Set the checkbox's internal ID to custbody_wipetax.
Customization > Scripting > Scripts > New Script
Under Script File field, upload the JavaScript > Create Script Record > User Event
Give it a good name.
Under Script tab, set BEFORE SUBMIT FUNCTION to userEventBeforeSubmit.
Under Deployments tab, apply the script to Invoice. Give a good deploy name, set Deploy to true, set Status to Released, and Log Level to Debug. SAVE.
Click into the Invoice Deployment will bring up the Script Deployment record. Here you can set Execute As Role = Administrator.
Comments
Post a Comment