Creating Script for MassUpdate
Hi,
I am trying to update a bank payment format in bulk for specific vendors. I couldn’t fine a correct CSV record type for this filed, hence I thought I need to use mass update and need to create a script for it. But I am not very familiar with scripting, would anyone be able to help?
Thank you
Yes, I can certainly help you with creating a script for mass updating bank payment formats for specific vendors in NetSuite.
Here are the steps you can follow:
-
- First, create a Saved Search to identify the vendors for which you want to update the bank payment format. You can use various criteria in the Saved Search to filter the vendors, such as location, subsidiary, vendor category, etc. Make sure to include the internal ID of the vendor in the search results.
- Once you have the Saved Search, go to Customization > Scripting > Scripts > New to create a new script. Choose the Client Script type.
- Set the script’s Name and ID, and select the appropriate API Version.
- In the Script record, go to the Script Deployment section, click on New to create a new deployment, and select the Saved Search you created in Step 1 as the deployment criteria.
- In the Script record, go to the Script tab and write the script to update the bank payment format for the vendors returned by the Saved Search. Here is some sample code you can use:
function massUpdateBankPaymentFormat() { var vendorSearch = nlapiLoadSearch('vendor', 'YOUR_SAVED_SEARCH_ID_HERE'); var searchResults = vendorSearch.runSearch(); searchResults.forEachResult(function(searchResult) { var vendorId = searchResult.getValue('internalid'); // replace YOUR_FIELD_ID with the internal ID of the field you want to update nlapiSubmitField('vendor', vendorId, 'YOUR_FIELD_ID', 'YOUR_NEW_VALUE'); return true; }); }
-
- Replace the YOUR_SAVED_SEARCH_ID_HERE, YOUR_FIELD_ID, and YOUR_NEW_VALUE placeholders with the appropriate values for your specific use case.
- Save and deploy the script.
Once you have deployed the script, you can run it by going to Lists > Mass Update > Mass Updates > New. Select the script you just created, and follow the prompts to update the bank payment format for the vendors returned by the Saved Search.
Sorry for the delayed response – thank you very much for this. Tested and it worked!



