Unable to programmatically start Playbook – Script Include, Business Rule, or Flow attempts not work

John24
Tera Contributor

I’ve been trying to programmatically start a Playbook in ServiceNow and wanted to check if anyone has successfully done this using:

  • Script Includes
  • Business Rules
  • Flow Designer (Flow / Subflow / Custom Action)

So far, none of my attempts have worked as expected.

 

1) sn_playbook.PlaybookExperience.triggerPlaybook(playbookScopedName, current);

 

2) var playbook = new sn_playbook.Playbook();
playbook.startPlaybook('sys_id_of_your_playbook', current);
4 REPLIES 4

Ankur Bawiskar
Tera Patron

@John24 

but why to trigger from script?

Let it trigger from field update based on matching condition

I could see this link, see if that helps

How to trigger playbook using button from workspace? 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Based on which RITM is created → start the correct playbook (Playbook1, Playbook 2, Playbook 3…).

 

I'm starting it from request because I'm calling it when order guide is created and it normally comes with 3 or more request item attached to the request. The trigger condition is only allowing me to call 1.

Playbook1 to start

REQ (1 record) ├── RITM 1 ├── RITM 2 ├── RITM 3
Playbook2 to start
REQ (2 record) ├── RITM 4 ├── RITM 4 ├── RITM 5
Playbook3 to start
REQ (3 record) ├── RITM 6 ├── RITM 7 ├── RITM 8
 
What I really want to happen:
IF RITM = Playbook 1 → Start DAP playbook
 
IF RITM = Playbook 2 request type → Start Playbook 2
 
IF RITM = Playbook 3 request type → Start Playbook 3
 
Since I'm running this from a scoped app, I'm trying to do this without add a new field in request table since I'm working in global scope. 
 

Tanushree Maiti
Kilo Patron

Hi @John24 

To programmatically start a Playbook in ServiceNow , you can use the  PlaybookExperience - Scoped API

 

Refer: 

PlaybookExperience - Scoped 

Create a playbook 

 

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

I already tried that. I already called that method, nothing happens. It's not starting the playbook. My codes are in scoped application.