Reputation: 65
i'm tying to get record form item fullfilment
/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*@author test
*/
define(['N/record'],
function(record){
function beforeSubmit(context){
var currRec = context.newRecord;
var currRec = record.submitField({
type: record.Type.itemfulfillment,
id: currRec.getValue('custbody_me_f_date_item_fulfillment'),
values: {
custbody_me_f_date_item_fulfillment: currRec.getValue('custbody_me_f_date_item_fulfillment')
},
/*options:{
enableSourcing: false,
ignoreMandatoryFields: true
}*/
});
}
return{
beforeSubmit:beforeSubmit
};
});
but when I run there is an error like this
TypeError: Cannot find function submitField in object [object Object].
how to solve this error. thanks for helping
Upvotes: 0
Views: 191
Reputation: 400
Your code is correct, but, it should be record.submitFields
not record.submitField
.
Also take note, the return of that function is the internal ID of the record NOT the actual record.
Upvotes: 0
Reputation: 85
The error is because submitField isnt a function that is available in that module. If you want to update a field on a record you can use the "setValue" function of the "Record" object to set the value of a field and then call the "save" function to save the changes to the record. Like this:
currRec.setValue({
fieldId: "custbody_me_f_date_item_fulfillment",
value: currRec.getValue("custbody_me_f_date_item_fulfillment"),
});
currRec.save();
Upvotes: 1