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 custom script in workflow run script block

Meghana B Srina
Kilo Contributor

We want to run few custom scripts which will be triggered at a certain stage of workflow. One such script is the below curl command which triggers a CI job in jenkins:


curl -X POST -u username:password https://demo.example.com/job/sample/build?token=xyz


I have added a "Run Script" block in my workflow, but not sure what is the code to be added in the script section to get the above line executed. Can someone please help.

1 ACCEPTED SOLUTION

Muralidharan BS
Mega Sage

Hi Meghana,

The easy way to do this is to create a rest message in the ServiceNow and use it in the script section. 

Simple steps:

https://docs.servicenow.com/bundle/rome-application-development/page/integrate/outbound-rest/task/t_ConfiguringARESTMessage.html

Once you have created the rest message you have the option to generate a script variable in the related links, you can just copy-paste that to the workflow script section,

 

find_real_file.png

 

Thanks

View solution in original post

3 REPLIES 3

Muralidharan BS
Mega Sage

Hi Meghana,

The easy way to do this is to create a rest message in the ServiceNow and use it in the script section. 

Simple steps:

https://docs.servicenow.com/bundle/rome-application-development/page/integrate/outbound-rest/task/t_ConfiguringARESTMessage.html

Once you have created the rest message you have the option to generate a script variable in the related links, you can just copy-paste that to the workflow script section,

 

find_real_file.png

 

Thanks

Thank you Murali! This was exactly what we were looking for! 

You've welcome!