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.

How to run a script in subflow

SHALIKAS
Tera Guru

We have a sub workflow which is used in all the catalog items. This has a run script activity which GlideRecords the sc_request table to populate some values. After that it waits for some duration and then a notification is sent. Now we are updating this to sub flow, As I am new to flow designer I am not able to get that how to run the script. Please help on this

1 ACCEPTED SOLUTION

Kavita_Bhojane
Tera Guru

Hi @SHALIKAS ,

 

Create a Subflow as below:

1. Define required inputs. Output not required

2. Use action "Update Record" to set Short Description and Requested For

To set "Requested For" use below script:

var reqFor;
if(fd_data.subflow_inputs.onbehalf_of_someone == "No"){
reqFor = fd_data.subflow_inputs.requester;
}
else{
reqFor = fd_data.subflow_inputs.requested_for2;
}
return reqFor;
3. Save
4. Now add Subflow in your flow and map required inputs.
5. Save and test the flow.
 Kindly refer attachments.
 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane

 

 

View solution in original post

7 REPLIES 7

okay cool then create a custom action.

 

Regards,

Ranjit

 

For that how can I access the variables from the variable set

Kavita_Bhojane
Tera Guru

Hi @SHALIKAS ,

 

Create a Subflow as below:

1. Define required inputs. Output not required

2. Use action "Update Record" to set Short Description and Requested For

To set "Requested For" use below script:

var reqFor;
if(fd_data.subflow_inputs.onbehalf_of_someone == "No"){
reqFor = fd_data.subflow_inputs.requester;
}
else{
reqFor = fd_data.subflow_inputs.requested_for2;
}
return reqFor;
3. Save
4. Now add Subflow in your flow and map required inputs.
5. Save and test the flow.
 Kindly refer attachments.
 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane