Reputation: 51
I am using NetSuite's SuiteScript 2.0 & currently I am working on Suitelet Forms. I have a case in which I am adding a button on my Suitelet form by using Form.addButton({id:'search',label:'Search',functionName:'customSubmit'});
I have attached a custom client function i.e. 'customSubmit'
on my Suitelet form button. I want to get & set some Form field values in my 'customSubmit'
function, is there any way in SuiteScript 2.0 through which I can do this.
Upvotes: 2
Views: 6424
Reputation: 51
Received the working solution from NetSuite support, it says..
I would suggest you to use currentRecord module in your client script. Please be informed that the currentRceord module is not documented yet in the help article. However, we already have a defect (387882) for this and is the module will be available in 2016.2 help article.
Please find the code snippet below.
/**
*@NApiVersion 2.0
*@NScriptType ClientScript
*/
define(["N/currentRecord"], function(currentRecord){
var pageInit = function(context) { } //just to add an entry point
var customSubmit = function(context) {
var val = currentRecord.getValue({fieldId: 'field_id1'});
currentRecord.setValue({fieldId: 'field_id2', value: val});
}
return {
pageInit: pageInit,
customSubmit: customSubmit
}
});
Upvotes: 3
Reputation: 2850
Your customSubmit function will execute as client side script. So just write it as if you are creating a client side script for NetSuite.
Upvotes: 0