Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Include an Attachment in Request Approval

ID NOBLE
Tera Expert

Hello,

I have a requirement that when an approver approves a request related to a particular item, there should be a MANDATORY attachment (document) included in the approval. Please I need help on how to do this.

 

Thanks.

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @ID NOBLE , 

I have following in this case.

1) Approval table [ sysapproval_approver ] serve the purpose at global level, try to avoid any custom update/configuration.

 

2) There is attachment option, approver can upload the document, this document will link to attachment table [sys_attachment], user need to open approval record to review this doc after approval.

 

3) Finally, if custom implementation can not avoid, you can add one checkbox type field [readonly] in approval table and make it mandatory for "particular item" of approving record [ client script ], write a BR [ before , update ] on approver table and check for "particular item" of approving record, if there is an attachment in sys_attachment table then mark the checkbox = checked else abort it.

 

You can add more, if i missed something here.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Danish Bhairag2
Tera Sage

Hi @ID NOBLE ,

 

U can create a before insert BR on approval table with appropriate condition so that BR triggers only in ur scenario n in the advanced section u can write below script.

 

var count = getSCAttachmentCount();

 

if(count > 0){

 

}else{

g_form.addInfoMessage("please add an attachment before Approving");

current.setAbortAction(true);

}

 

Thanks,

Danish