Posts

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

Troubleshoot : Purchase Order did not Auto Generate for Drop Shipping

Image
Issue: You have created a Sales Order that includes one or more Drop Ship item (item record that has the checkbox Drop Ship enabled) > Save. You expectation is that NetSuite will automatically generate the Purchase Order on the dropship items for you.  This is standard NetSuite drop ship behavior. What actually happened is it didn't, you still have to manually Drop Ship it from the CREATE PO sub list column. You don't have custom script or workflow running on sales orders. Resolution: CHECK your item setup for Purchase Price. CHECK your item setup for Preferred Vendor. CHECK your item setup for Subsidiary of Preferred Vendor matching your Subsidiary of Sales Order. CHECK your sales order is Approved. If the standard behavior is not working, it is most likely due to the item setup.  Focus on item setup and go from there.

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

Saved Search Build : Find And Replace Substrings

Image
Build Difficulty: 💗💗💗💗 The time has come that you need to find certain string in the column and replace it with a hard-coded ones.  Additionally, we are combining this search & replace with a nested comparison logic. Exercise goal: look at the Posting Period and replace with the first of the month instead of of the abbreviations in the results.  For example, transform from "Feb 2022" to "2-1-2022". TRANSACTION search CRITERIA Posting = T RESULTS Document Number Formula Text = "CASE WHEN REGEXP_SUBSTR({postingperiod},'\A\w\w\w\s')='Jan ' THEN REGEXP_REPLACE({postingperiod},'\A\w\w\w\s','1-1-') WHEN REGEXP_SUBSTR({postingperiod},'\A\w\w\w\s')='Feb ' THEN REGEXP_REPLACE({postingperiod},'\A\w\w\w\s','2-1-') WHEN REGEXP_SUBSTR({postingperiod},'\A\w\w\w\s')='Mar ' THEN REGEXP_REPLACE({postingperiod},'\A\w\w\w\s','3-1-') WHEN REGEXP_SUBSTR({postingperiod},'\A\w\...

Saved Search Build : Just the Posted Transaction Lines

Image
Build Difficulty: 💗💗 This one is for when you like to get only the posting lines that are created or approved within the x amount of days as specified.  These will be in the GL accounts and you should not be seeing any sales order, purchase orders, and requisitions.  Also, you should not see any unapproved transactions. TRANSACTION search CRITERIA ( Type is Journal OR Main Line = F ) AND (( System Notes : Field = Posting Period AND System Notes : New Vale is not empty AND System Notes : within 5 days ago and 1 days ago ) OR ( Posting = T AND Date is within 5 days ago and 1 days ago )) RESULTS Internal ID Document ID Date Period Account : Number Type Amount Word of Wisdom In this example the x day is set to 5, obviously you may interchange this as you wish. When posting period is not empty it would imply posting is true. Journals do not have the notion of main lines.  In fact, if you try to look for main line in journals you will see return of null value (this is also a ...