setabort action not working for delete

ABC6
Tera Contributor

i have to restrict non admin user to stop deleting attachment from std_change_record_producer for which i have written below code against std_change_record_producer its a before delete, please let me know where i am doing wrong , even log is not generating for the same

ABC6_0-1742387823040.png

 

1 ACCEPTED SOLUTION

@ABC6 

The lead should already know the reason.

Reason is the delete actually works on sys_attachment as attachment is getting deleted and not the actual record on which the attachment is present.

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

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@ABC6 

business rule should be on before delete on sys_attachment table and not on std_change_record_producer 

no script required, only keep this

current.setAbortAction(true);

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

My lead is not approving the same .that is why i am using the logic on
std_change_record_producer,please help me with my query

@ABC6 

then your lead probably doesn't know much about how sys_attachment works

Can't help much then

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

So what could be the best reason to say that this solution won't work