Test Before You Script

a screenshot of elements found

Share This Post

One of my favorite Netsuite tricks is that suitescript APIs can be used in the dev console.  Especially for beginning developers, finding the right API, internal id, etc.. can be tricky but by using the dev console you can get a real time example of how your script will affect a record. 

Here’s an example: 

Your client has has an integration with a 3PL that generates Item Fulfillment records when the 3PL picks the order.  The problem is that the 3PL’s shipping cost and what the client charge for shipping don’t match.  The client requests that the shipping cost from the sales order be used on the invoice instead of the item fulfillments shipping cost.  We’ll use the dev console to work through the code and see what works, and if we make a mistake we can just refresh the page to try again. 

On an invoice first we’ll need the sales order record, 

var createdFrom = nlapiGetFieldValue(‘createdfrom’); 

Variables you create in the dev console will stick around until you navigate away or refresh the page. 

var salesOrder = nlapiLoadRecord(‘salesorder’, createdFrom); 

Now we can access all the sales order data, lets grab the shipping cost. 

var salesOrderShippingCost = salesOrder.getFieldValue(‘shippingcost’); 

Great!  Now to put it in it’s new home. 

nlapiSetFieldValue(‘shippingcost’, salesOrderShippingCost); 

We can now collect all our lines of code into a function and created a script record and deployment for the client’s use case.  The above example is simple but using the dev console during troubleshooting scripts can be immeasurably valuable in understanding how your code is interacting with Netsuite. 

Schedule A Meeting Today!

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Blog

Sustainability in Field Service: Strategies for Going Green

For field service professionals, adopting sustainable practices is not just about being environmentally responsible; it’s about enhancing operational efficiency, reducing costs, and meeting the growing expectations of eco-conscious customers.

Do You Want To Boost Your Business?

drop us a line and keep in touch

Learn how we helped 100 top brands gain success.

Let's have a chat