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!

Rookie Asked on January 25, 2022 in SuiteScript.
Add Comment
1 Answer(s)

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

Intermediate Answered on January 26, 2022.

Thank you!

on January 26, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor