Reputation: 13
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?
Upvotes: 1
Views: 4969
Reputation: 5286
In order to allow the record to be submitted, you need to return true
from the saveRecord()
function, thus:
/**
*@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
};});
Upvotes: 2