1

I want to edit a record, then click "Save" and the field "custitem_con" to be updated with a new value and the record saved.

/**
*@NApiVersion 2.0
*@NScriptType ClientScript
*/
define(['N/currentRecord'],
function(currentRecord) {
function saveRecord (){
var objRecord = currentRecord.get();
var con = 'Success!...but record is not saved :(';
objRecord.setValue({
                fieldId: 'custitem_con',
                value: con,
                });
}
return {
saveRecord: saveRecord
};});

However while the field custitem_con gets the value, the record is not saved, but remains in edit mode. How do I get the record saved?

4

1 回答 1

2

为了允许提交记录,您需要return truesaveRecord()函数中,因此:

/**
*@NApiVersion 2.0
*@NScriptType ClientScript
*/
define(['N/currentRecord'],
function(currentRecord) {
function saveRecord (){
var objRecord = currentRecord.get();
var con = 'Success!...but record is not saved :(';
objRecord.setValue({
                fieldId: 'custitem_con',
                value: con,
                });
return true;
}
return {
saveRecord: saveRecord
};});
于 2018-02-19T21:39:39.743 回答