Skip to content

OpenAir is a renowned and highly sought-after PSA tool for its advanced features, capabilities, and seamless integration capabilities. Its inherent flexibility and customizability make the platform even more powerful.

OpenAir’s scripting capabilities let you create custom enhancements for your system and business so you can go behind the scenes and modify things the platform does not do right out of the box. It uses standard JavaScript with an OpenAir-specific library to execute commands. 

Scripting capability lets you customize your OpenAir experience and tailor the tool to your unique needs for enhanced business efficiency and productivity. In this article, we will delve into advanced tips and techniques, enabling you to harness the full potential of OpenAir scripting.

Types of Scripts 

Form Scripts 

Form Scripts execute automatically when specific events take place, such as saving, submitting, or approving a form. While their primary purpose is to facilitate form validation, they can also serve a limited role in manipulating data.

Form examples: 

  • Incurred vs. forecast recognition rule form script 
  • Invoice form script 
  • Project issue form script 
  • Project milestone form script 

Scheduled Scripts 

Scheduled scripts operate on a predetermined timetable, with the frequency ranging from as often as every five minutes to daily or weekly, depending on your specific requirements and desired execution frequency. These scheduled scripts are particularly well-suited for tasks involving data manipulation and adjustments, and they possess the capacity to handle larger volumes of data compared to form scripts.

Unlike form scripts, you have the autonomy to manually configure and initiate scheduled scripts, allowing you to dictate when and how frequently the script should execute. Nevertheless, it’s worth noting that setting up scheduled scripts often necessitates additional setup steps, which can exclusively be carried out by NetSuite support when operating within a sandbox environment.

Examples: 

  • Summing the total of planned or booked hours on all tasks for a project and moving that total to the budget (hours) field on the project 
  • Splitting fixed fee revenue transactions to the users that worked toward that revenue, distributing proportionally by hours worked 
  • Copying a field on a project’s properties to every charge associated with that project

Scripting Governance 

OpenAir enforces restrictions on the execution of scripts, encompassing limitations on transactions, time allocation, and the number of emails that can be triggered. Each script command consumes a specific number of units. To illustrate, retrieving a value from a form consumes one unit, logging an error message requires four units, and fetching data from a database consumes 20 units. Therefore, it’s crucial to be mindful of the constraints imposed by scripting governance.

The challenge associated with scripting governance arises when dealing with substantial amounts of data for reading and manipulation. In cases where the volume of data becomes overwhelming and your allotted execution time is running out, it is prudent to consider strategies such as dividing the task into multiple scripts or implementing additional filters. For instance, if your script’s objective is to retrieve information about all active projects, you might want to implement filters that restrict the retrieval to projects in specific desired stages, thereby conserving your units effectively.

Form scripts governance limits:  

  • 5 secs run time 
  • 1,000 units 
  • 3 emails (email subject is 1st line passed, 1,000-char max) 

Scheduled scripts governance limits: 

  • 1 hr run time 
  • 1,000,000 units 
  • 100 emails (email subject is 1st line passed, 1,000-char max)

Scripting Within OpenAir 

OpenAir has a dedicated Scripting Center for your script development and deployment. You can access the center by clicking the Administration gear icon at the bottom left. It will show Form and Scheduled tabs and Library, Parameters, and Solutions, which are additional functions to further refine the scripting experience. 

Script Development/Deployment Cycle 

The Scripting Center has a built-in workflow for the development and development testing to occur in any OpenAir environment without affecting data by anyone but the developer or user. In other words, a script can exist in your production environment without impacting users except for the identified tester. 

The workflow or the status lets you know what the script will do or how it will run, encompassing inactive, testing, active, and active revising phases in that order. Once you develop a new script, you test, deploy, and revise it where necessary (deploy or discard changes). 

Scripting Center Functions

The following is a quick reference of the scripting center functions and their purpose: 

  • Scripting Studio: identifies script test owner, initial function, called libraries, etc. The script owner must have data view, and permissions to act on script impacted data for the script to work. 
  • SOAP Explorer: contains all the tables and fields available for script use. 
  • Functions Explorer: displays all of the OpenAir-specific JavaScript functions. 
  • OData Explorer: displays all reports and lists views published to an OData server, along with the views’ associated fields. 
  • Script Parameters: allows parameters to be sent to a script (advanced)
  • Custom fields: displays instance-specific custom fields and associated tables 
  • Terminology: displays instance-specific terminology 
  • Form Schema (form scripts only): shows form fields with their API names 

OpenAir-Specific JavaScript Libraries

The OpenAir-Specific JavaScript libraries all start with the “NSOA” prefix.  The following is a quick reference along with a short explanation of  its function:

  • NSOA.context –  system information on how you can track unit usage 
  • NSOA.form – retrieve data from saved or submitted forms 
  • NSOA.meta – used for logging and alerts 
  • NSOA.NSConnector – lets a script execute the pre-configured NetSuite integration on all data (scheduled script) or a single record (form script)
  • NSOA.record – for the creation of specific objects that match OpenAir’s database 
  • NSOA.report – used to access metadata associated with reports published with OpenAir Business Intelligence Connector
  • NSOA.wsapi – used to manipulate the data in the OpenAir database 
  • NSOA.https – Connect to other applications via web service methods 

Using Scripting Logs

OpenAir scripting logs are records that capture essential information about the execution of scripts within the OpenAir platform. These logs provide valuable insights into the script’s behavior, including any errors, warnings, or successful actions performed during script execution. By reviewing these logs, users can troubleshoot issues, monitor the performance of their scripts, and ensure that scripts are running as intended. 

OpenAir scripting logs play a crucial role in maintaining script governance and debugging, helping users identify and rectify any issues that may arise during the scripting process, ultimately contributing to the reliability and effectiveness of automated tasks within the OpenAir environment. 

Here are a few quick tips for using scripting logs: 

  • Generate a script log line at every significant event in the script 
  • Log the number of records read when using the NSOA.wsapi.read function 
  • Log read results, particularly when building integrations 
  • Evaluate the results of any NSOA.wsapi.add or NSOA.wsapi.modify statement and write successes or failures and error codes to the log. 
  • Keep track of your governance limits by logging the values of the NSOA.context.remainingUnits and NSOA.context.remainingTime functions. 
  • Be careful with dates. There is a difference between JavaScript, OpenAir, and String data objects; they are not interchangeable 
  • There are six levels of script logging that you need to take advantage of. They include, ‘Fatal’ ‘Error’ ‘Warning’ Info’ ‘Debug’ and ‘Trace’ 

Bottom Line 

OpenAir scripting is a powerful tool to optimize your OpenAir solution to your business needs, increase data accuracy, alert you when events occur, and provide integration capability. To learn more about OpenAir scripting watch OpenAir Advanced Scripting Tips & Techniques. 

About Us:  Our mission is to enable and empower Professional Services Organizations to become profitable, scalable, and efficient through change management, technology deployment, and skill set training with a Customer First approach.

Scroll To Top