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 End a Playbook

lpruit2
Kilo Sage

Greetings all,

 

I'm trying to educate myself on the use of Playbooks within ServiceNow. I have built various Flow Designer solutions in the past. This may seem like a silly question but how do you end a Playbook after a Decision / If condition statement? In my Playbook, I have an Ask for Approval task. After this task there is an If statement. I want to end the Playbook if the Approval request is rejected. I don't see any Playbook activity or Flow Designer activity that I can use to accomplish this. I also tried dragging the connected line to the end of the Playbook but that is not working. Any information anybody can provide would be appreciated. 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@lpruit2 

I don't think we can.

May be try some script to mark complete all the activities within the lanes.

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Mohammed8
Tera Expert

Hi @lpruit2 

This Question was raised earlier and suggestion was given ServiceNow team.

Here is trail you can check:

https://www.servicenow.com/community/workforce-optimization-forum/manually-closing-a-case-and-termin... 

 

If you find this helpful please mark it solution accepted/helpful

 

Thanks and Regards,

Mohammed Zakir

VishalV02239290
Tera Contributor

Not sure on how to from the playbook. But maybe give this a try - write a BR or a server script to check the approval status and then use script to drive the cancel or closure of the playbook.


// Mark associated playbooks as completed with a status message
sn_playbook.PlaybookExperience.completePlaybooksByParentRecord(current, "approval rejected");

 

//to cancel playbook

sn_playbook.PlaybookExperience.cancelPlaybooksByParentRecord(current, "approval is rejected");