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.

guided setup

garimakharb
Giga Guru

I am creating a Guided setup .. and I got to know that it is itself a playbook.
So, Can someone know? that How to call a script action in playbook?

 

2 REPLIES 2

MaxMixali
Kilo Sage

Using the "Run Script" Action

  1. In your Playbook, add an action step
  2. Search for and select "Run Script" action
  3. In the script field, write your JavaScript code
  4. You can access playbook context variables using the inputs object
 
 
javascript ssample code:
(function execute(inputs, outputs) {
    // Your script logic here
    var result = inputs.input_variable;
    
    // Process your logic
    gs.info('Processing: ' + result);
    
    // Set outputs if needed
    outputs.output_variable = 'some value';
    
})(inputs, outputs);

kaushal_snow
Giga Sage

@garimakharb ,

 

You can trigger by inserting a playbook_trigger record (e.g. in a UI Action or any ), and then inside the Playbook use a declarative action of type server script (on your playbook card or stage) to run your custom logic using the current object, this lets you run any script include or server logic in a low code way inside the Playbook........

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/