Posts

Showing posts with the label SuiteScript

SuiteScript : Track Original Transaction (the Copied From)

Image
Script Difficulty: 💚 💚 💚 Ok, so have you ever wonder if a transaction is copied or created from scratch?  And if it is copied from another transaction, well, where did it come from originally? In this exercise we have a client script that tracks your records as the users process the transaction in such a behavior.  The user start out by opening an existing record then clicking "Make Copy". The script kick off a series of validation checks and grabs its original transaction and dump it in a customer field (Type record).  The administrator (or power user) can later run a report base on this field for audits. If the transaction is not copied (meaning it is created from scratch) then the custom field will left blank.  In essence, if you see a non-blanks in this tracking custom field, you know it is a copy. The solution does a one pass check (it will only check as far back as one copied at a time).  If  the record has already make multiple copied passes, you ...

SuiteScript : Defaulting Tax Code at Line Level

Image
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...