remove Delete from related list "Action on selected rows"

samadam
Kilo Sage

On change request I have a related list that is a m2m relationship to a custom table. How can I disable Delete option to all users from the "Action on selected rows". I tried to use ACL but restricting delete is disabling the removal of the related records using the Edit button. I created a new ui action on this table and tried to restrict to admin but doesn't work. How can I disable this?

 

1 ACCEPTED SOLUTION
5 REPLIES 5

Kumar Premankit
Tera Expert

When you edit the M2M table, the changes are essentially deletions or additions. Let's focus on the deletion aspect from your requirement perspective. If you decide to remove a relationship, it performs a background deletion of that relationship. By disabling the delete function, you are preventing any edits or removals of the relationship.

Could you please clarify the true intention behind disabling the delete function? Why do you prefer that only admins manage the M2M relationships?

Shivalika
Mega Sage

Hello @samadam 

 

Please create a "Deny Unless" Type "Delete" ACL for this record - this takes precedence over "Allow If" ACLs. So even if there are multiple ACLs granting access to any other roles it will be denied. 

Something like below - choose your M2M table here. 

 

Shivalika_0-1743397585782.png

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

 

J Siva
Tera Sage

Hi @samadam 
You can acheive this by modifying the exisiting "Delete" ACL on your custom table.
1. Open the Delete ACL of type record on your custom table

2. In the "requires roles" section, add "admins"  and remove the other roles (if any)

Hope this helps.
Regards,
Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@samadam 

share ACL is created on which script etc?

share screenshots.

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