While NetSuite is an excellent ERP application that can handle most situations your users will throw at it right out of the box, there may be times when your business needs a little bit more than the standard features.
Luckily, to add to its already awesome arsenal, NetSuite allows users to create their own custom solutions for their business-specific scenarios.
We recently worked with a client who wanted to default the Class value for Vendor Bills based on the account selected. Simply creating a custom field on the account to set the default class was not sufficient enough to provide the desired functionality. They noticed that while entering vendor bills, the class value was not automatically filled in on the line level after they selected the account (this is not a standard NetSuite feature).
Rather than entering these Class values manually, we created a customization that automatically populated the Class when an account was selected. The solution saved the client time and trouble when dealing with a large number of accounts.
In order to build this solution, I created custom fields, wrote a script, and deployed the script to a record. In the example below, I will guide you through each step of this customization for a better understanding of how you can build your own customizations for NetSuite.
1. Create a Custom Field on the Account to Set the Default Class
The first thing we need to do for this customization is to create the field on the record you would like to modify. These are referred to as custom fields, seeing they are not standard in NetSuite. In this example, we’ll create a Class field on the Account record with the source of data to be selected as the list of Classes.
- Navigate to Customization > Lists, Records, & Fields > Other Custom Fields > New
- Specify the type of field you want to create
- If a List/Record type, specify which list or record. In this example, we’ll use the
- This field now appears on the account record
2. Set the Default Class Value on the Accounts
The next thing that needs to be done is selecting the value for this record.
To do this:
- Create a new Account or navigate to an existing account
- Choose the Class value that you want to set on the Vendor Bill when the Account is selected
- Save the record
3. Write a Script
Using your preferred IDE, write a client script that executes whenever the account field is changed.
- Write client script using SuiteScript 1.0 or SuiteScript 2.0 using the fieldChanged client event type
- Below is a sample of some of the required code:
4. Create a Script Record
- Create a script record that references the SuiteScript you wrote in the previous step
- Type the name of your function in the ‘Field Changed’ function field
- Save and Deploy your script
5. Deploy Your Script
- Attach your script to the transaction record. You will want the Class to be set based on the Account you have selected. In this example, we’ll use Vendor Bill.
- At first, keep the status of your script set to “In Testing.” Once you’ve run a few tests and verified that the script works perfectly, then you can go ahead and change the status to released.
6. Test by Creating a New Vendor Bill
On each change of Account, the Class column will automatically fill in with the Class value you chose for that Account.
- Select account
- Notice how the column automatically fills in with the value you saved
- This only happens when you first choose the account; you are free to choose whichever account after if you choose
Congratulations! You now know how to create custom fields, as well as create and deploy script records. You can apply this knowledge to other types of fields, records, and transactions to create your own customizations that will optimize NetSuite for both you and your organization.
If you have questions about NetSuite customizations or NetSuite in general, we’d be happy to help. Just contact us using the form below!