How to create custom posts using namescript in netsuite?
var recExpense = nlapiCreateRecord("customrecord_expense");
recExpense.setFieldValue(1028,"3223");//employee number
nlapiSubmitRecord(recExpense);
I just wrote this simple code to create a new custom record, but after only an empty record is created, the method setFieldValue
doesn't work and it doesn't update the field value.
What am I missing? And how do you create custom recordings using SuiteScripts?
+3
source to share
1 answer
The above code doesn't work because you have to put internal id
in the field you want to update, not the record ID.
var recExpense = nlapiCreateRecord("customrecord_expense");
recExpense.setFieldValue('internalid_of_the_field',"3223");//employee number
nlapiSubmitRecord(recExpense);
Note. You can go to your record and just click on the field you want to update, a help window will appear, and at the bottom you can get internal id
that field.
+2
source to share