Playbook - Add activities dynamically at runtime

Daxin
Tera Expert

Hi All, 

 

Is there a way to add dynamically add activities to the playbook at runtime by script?

I can do this by adding an optional activity and then add them during playbook execution manually but wanted to check if there a way to do this automatically. 

The requirement is I need too add the activities multiple number of time based on the selection made on the previous  activities. 

 

Thanks. 

1 ACCEPTED SOLUTION

Jason Lefever
ServiceNow Employee
ServiceNow Employee

@Daxin 

We do support this today. Check this out - dev doc on the various Playbook API's that are available, including adding optional activities. 

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Daxin 

I don't think this is feasible within playbook.

Activities within playbook can be configured once before publish, you can update and add again new activity later and re-publish again.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Jason Lefever
ServiceNow Employee
ServiceNow Employee

@Daxin 

We do support this today. Check this out - dev doc on the various Playbook API's that are available, including adding optional activities. 

Thanks Jason.  That worked. 

For others reference , there are two namespaces for managing Playbooks through script

sn_playbook - to cancel, restart, trigger playbooks etc.

sn_pad - to activate, deactivate playbooks, add optional activities etc.