Can we trigger a playbook through ui action new

veenal
Tera Contributor

Hi , 

Can we trigger a playbook for creation of a record i.e as soon as i click on ui action new . The playbook should get triggered asking for info and as i submit info and continue . It should create record for me in details in workspace .Kindly let us know how to configure .

Regards,

Veenal 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@veenal 

link shared by @SD_Chandan has the script from ServiceNow docs itself.

please try that and let us know

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

kaushal_snow
Giga Sage

Hi @veenal ,

 

Add this script in your ui action..

 

var playbookTrigger = new GlideRecord('playbook_trigger');
playbookTrigger.initialize();
playbookTrigger.playbook = 'sys_id_of_your_playbook'; // Replace with your playbook's sys_id
playbookTrigger.target_table = current.getTableName();
playbookTrigger.target_sys_id = current.sys_id;
playbookTrigger.insert();

 

Add Playbook to Workspace:

 

Navigate to All > Workspace Experience > Actions & Components > Related Items.

Click New to create a new related item...Set the Table to the same table as your UI Action (e.g., incident).

Action label to something like "Playbook".

Implemented as = UI Component.

Set the Specify UI Component to now playbook experience.

 

In the Component Attributes tab, set the following attributes:

playbookExperienceId: The sys_id of your playbook.
parentSysId: {{sysId}} (this dynamically references the current record's sys_id).
parentTable: {{table}} (this dynamically references the current record's table).
compactMode: false (set to true if you want a compact view).

>> Test the Configuration: Navigate to a record of the table where you added the UI...

 

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/