Not Getting Error Info

ABC6
Tera Contributor

Hello Team ,
i am restricting ITIL user not to Delete attachment from manage attachment for table named "std_change_record_producer" .

To achieve this i have written a BR on sys_attachment table , everything is working fine but i am not been able to get Error info Message while removing the attachment,Please let me know where exactly i am doing wrong below are the code

 var user = gs.getUser();

    if (user.hasRole('itil') && current.table_name=='std_change_record_producer') {
            gs.addErrorMessage('ITIL User are not authorized to delete attachments from this record.');
            current.setAbortAction(true);  
        }
1 ACCEPTED SOLUTION

Viraj Hudlikar
Giga Sage

Hello @ABC6 

 

If I follow this KB article and when i implemented as per requirement it worked for me do try this. https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0825743

 

My BR is as below:

VirajHudlikar_2-1742212927215.png

VirajHudlikar_3-1742212948008.png

 


Me as system administrator can delete it

VirajHudlikar_1-1742212878042.png

 

Abel Tutor who has ITIL role cannot delete.

VirajHudlikar_0-1742212836166.png

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

View solution in original post

7 REPLIES 7

Viraj Hudlikar
Giga Sage

Hello @ABC6 

 

If I follow this KB article and when i implemented as per requirement it worked for me do try this. https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0825743

 

My BR is as below:

VirajHudlikar_2-1742212927215.png

VirajHudlikar_3-1742212948008.png

 


Me as system administrator can delete it

VirajHudlikar_1-1742212878042.png

 

Abel Tutor who has ITIL role cannot delete.

VirajHudlikar_0-1742212836166.png

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

My lead is not approving the same he wants i need to perform the same logic from standard change table not from sys_attachment

Hello @ABC6 

 

In that case you can refer below thread - Solved: How to disable add/delete attachments on some chan... - ServiceNow Community

 

See at the end the attachment is attached on sys_attachement table so operation need to do on this table and from standard change table on what basis it can be checked?

 

Happy to hear new solution from your lead.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

Thanks & Regards
Viraj Hudlikar.