Thursday, May 16, 2019

Getting invalid field value error when setting 'trandate' via SuiteScript

Below is a sample of scheduled script that creates a sales order record and sets the trandate. The common error we are getting is invalid field value for trandate.

(1) Create a script using this below snippet:

var record = nlapiCreateRecord('salesorder');
record.setFieldValue('entity', 112);
record.setFieldValue('trandate', '10/29/2013');
record.setCurrentLineItemValue('item', 'item', 109);
record.setCurrentLineItemValue('item', 'quantity', '1');
var item1 = nlapiSubmitRecord(record, true, true);

(2) Create new Scheduled script and deploy it.

Setup > Customization > Script > Scheduled Script > New
Function: SOscheduled
Go to Deployments subtab
Title: Create Sales Order

(3) Manually run the deployment.

Result: Getting is invalid field value for trandate.

(1) Go to Home > Set Preferences > Set Date Format to MM/DD/YYYY
For One World accounts:
(2) Also change the Date Format of your Subsidiaries
Setup > Company > Subsidiaries > Edit Subsidiary > Preferences Tab > Make sure that the Date format is the same as preferences



No comments:

Post a Comment