Oct 282013

One of the things that I find useful to understand when building tools on an existing framework is where the hooks are for scripting. I’ve been doing a lot of scripting over the last two years to optimize my company’s NetSuite deployment. A short list of some of the things that I’ve worked on include:

  • Time Entry Automation improvements
    • auto-format memos on time entries with date, ticket/project/task, and the event subject
    • Validation on Service Item, Payroll Item, Class– certain combinations are verboten but must be restricted via scripting as there is no built-in validation
    • Auto-complete Service Item, Payroll Item, Class– certain combinations are only allowed to be entered a certain way
  • Ticket validation improvements
    • Tickets are changed from New to In Progress when Engineer assigned
    • Repair tickets not allowed for T&M customers
    • Mandate entry of certain information when the ticket type is a certain value
    • Prevent internal tickets from CCing to customer contacts
  • Customer validation improvements
    • Validation on lots of fields including verifying that IP addresses and subnet mask info entered is valid for IPv4 format. Validate that DNS addresses follow the public standard. Auto-name records to reduce data entry. etc.
    • Enforce entry of critical information on new records (no half-creating a record allowed– sublist fields can’t be marked as mandatory except via scripting.)
  • Project validation improvements
    • Ensure certain roles are exempt from mandatory field requirement (conditionally required field based on role of person editing/creating the record)
  • Solutions validation improvements
    • Pre-formatting the Abstract and Details via custom button

When working on all of these, it’s important to understand the best place to hook the action into.

  • Do you want to prevent a user from entering certain values or values outside of the accepted format? Use validateField.
  • After changing a field value and post sourcing occurs (i.e., updating the customer on a ticket causes the contact to be cleared), do you want to ensure the original field value is restored (if possible)? Use postSourcing (note: in some cases, the parent value might prevent use of the child value because the child value is not an acceptable value under the new parent.)
  • Do you want to prevent a user from inserting new sublist (time entry) records to a closed event? Use validateLine within the parent event, use onSave from the Time Entry form.


Here’s the diagram that I’ve been keeping in my head (because NetSuite doesn’t supply one). I thought other NetSuite admins/consultants/programmers might find it handy.



I welcome comments, questions and feedback. I don’t normally post NetSuite or scripting related stuff to my blog as my primary role is not a coding role (even though I enjoy it on a limited basis. I prefer to use coding/scripting to enhance my primary job function, rather than my primary function being to code.)