Need to write a script for cascade deletion, Engagement records should be deleted when vendor delete

bejawada
Tera Contributor

Hi Community,

 

I have a requirement to provide an option of Delete button on Vendor Records for Vendor Manager role.

Whenever the delete button clicks associated Engagements should also get deleted. The delete functionality should be available on Vendor Management workspace.

Please help me in writing script for workspace delete button.

 

Thanks.

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @bejawada 

you don't need to script anything. just make sure that the respective cascade delete rules are set correctly. Then ServiceNow will delete referencing records automatically in case the parent records gets deleted.

See https://docs.servicenow.com/en-US/bundle/vancouver-platform-administration/page/administer/field-adm...

Maik

View solution in original post

10 REPLIES 10

Maik Skoddow
Tera Patron
Tera Patron

Hi @bejawada 

you don't need to script anything. just make sure that the respective cascade delete rules are set correctly. Then ServiceNow will delete referencing records automatically in case the parent records gets deleted.

See https://docs.servicenow.com/en-US/bundle/vancouver-platform-administration/page/administer/field-adm...

Maik

Hi @Maik Skoddow 

 

Thanks for your response. It is working after updating the cascade delete rules, whenever I delete a Vendor both Vendor and engagements are getting deleted along with that it is creating an empty Vendor record.

How to sort this?

Thanks

@bejawada 

Without any more details I cannot answer as I'm not able to read your thoughts.

Maik

I have used the below UI Action script in my environment and make it visible on the Form

https://dev180646.service-now.com/sys_ui_action.do?sys_id=cccac8a60b3303008e64aabcb4673ade&sysparm_v...

Since, the above UI action is in PDI, it can be accessed across all the PDI's.

Please take a look