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 attach a screenshot automatically in a custom field in Incident form?

Tanmay_Sahay
Tera Contributor

I have a screenshot stored within one table in ServiceNow. Whenever a incident is proposed to a major incident, I want to attach that screenshot automatically in that custom field, in the incident form.

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Tanmay_Sahay 

If you want to copy the file then do this

1) create a system property to hold that static image, add file there. in the value field add the system property sysId

2) use before update business rule with proper condition for Incident Proposed to Major Incident and set that field with sys_attachment sysId using this script

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    current.u_attachmentField = gs.getProperty('propertyName');

})(current, previous);

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

@Tanmay_Sahay 

Hope you are doing good.

Did my reply answer your question?

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