Arif Karadag
Arif Karadag

Reputation: 129

How can I create custom records with suitescript in netsuite?

var recExpense = nlapiCreateRecord("customrecord_expense");
recExpense.setFieldValue(1028,"3223");//employee number
nlapiSubmitRecord(recExpense);  

I just wrote that simple code to create a new custom record but after the execution just a blank record is being created setFieldValue method is not working and it does not update field value.
What am I missing? And how do you create custom records with SuiteScripts?

Upvotes: 4

Views: 4253

Answers (1)

Rockstar
Rockstar

Reputation: 2288

The above code didn't work because you have to put the internal id of 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 box will pop up and at the bottom you can get the internal id of the field.

Upvotes: 4

Related Questions