how to set a script parameter using SuiteScript 2.x
Hi all,
Is there a way for me to set a parameter on a script deployment record using SuiteScript 2.x? I know you could grab the parameter using:
var scriptObj = runtime.getCurrentScript();
var param = scriptObj.getParameter({ name: ‘some_param_name’ });
but can you somehow set this parameter to some value? What I would like to do is set a parameter to ‘true’ (it’s a checkbox) based on an answer from a multi-step Suitelet (I’m using the Assistant feature) and I’d like to script to dynamically set this parameter to ‘true’. Please let me know if I could provide more details. Thanks!
Hi,
Yes, you can do this. You need to load the script deployment record using record.load() and then set then set the field for the parameter on there.
let script_deployment = record.load({type: record.Type.SCRIPT_DEPLOYMENT, id: 12345}); script_deployment.setValue({fieldId: 'custscript_my_parameter', value: true}); script_deployment.save();
Thanks,
Chris
Thank you!