Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Scriptable order guide in workflow

omsa1
Kilo Guru

I need help with scriptable order guide that I've included in my workflow.Below script not working and its showing an error. i have a mandatory choice field on the main order guide form which need to select ADD (parameters.v_FunctionSelect = "efa9c1eadb129300dfafa026ca96192a" +"";) then sub form will appear where i need to fill up other mandatory fields as below. 

script as below:-

//Keep in mind:
//*This activity will automatically create a service catalog request.
//*For more info: http://docs.servicenow.com/?context=Running_Order_Guides_Automatically
var parameters = new JSON().decode(current.payload);
parameters.opened_by = current.opened_by+"";
parameters.v_RequestedFor = current.variables.requested_for+ "";
parameters.v_FunctionSelect = "efa9c1eadb129300dfafa026ca96192a" +""; //main order guide form mandatory field, select add
parameters.v_SecurityGroupDomain = "bb370616db82638c1e11f99468961980" +""; //sub form mandatory field 
parameters.v_SecurityGroupInfoCorp = "48a9e946db5127c80810f2f9af96194d" +"";//sub form mandatory field 
parameters.v_AddMembers = current.variables.requested_for.getDisplayValue() +"";//sub form mandatory field 
parameters.v_Reason = current.variables.u_business_justification.getDisplayValue() +"";//sub form mandatory field 

answer = new JSON().encode(parameters);

 

find_real_file.png

 

find_real_file.png

4 REPLIES 4

Omkar Mone
Mega Sage

Hi 

Can you first put that opened by in some other variable i.e 

var openedBy = current.opened_by+"";

and then

parameters.opened_by = openedBy;

 

Refer the thread below- 

https://community.servicenow.com/community?id=community_question&sys_id=914f66f2dbe4bbc00be6a345ca96...

 

Regards,

Omkar Mone.

Hi Omkar,

its not working. 

Hi 

Are you sure you have opened_by?

try doing toString() once instead of +"";

Regards,

Omkar Mone

lee embon1
Kilo Explorer

Hi, can anyone have a solution to this error?