How do I make an image a default value in a field?

luv2learn702
Tera Expert

Hi - I have a requirement to where we would like a screenshot/image of our priority matrix as a reference for our SD team in the incident form.  Is there a way to add an image to a field and have it a default value whenever a new incident record is created?

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@luv2learn702 

there is no direct way but here is a workaround explained by ServiceNow in KB article, follow it

How to set a default image on an image field (not knowledge) 

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

@Ankur Bawiskar Thank you for the guidance...this actually attaches the image to the record.  Is there a way to have the image set as default in a specific field?

@luv2learn702 

Do this

1) create a system property and attach the image to it, in the value field of that property add sys_id of the newly created system property

2) then use before insert BR on your table and use this script

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

	// Add your code here	
	var sysId = GlideSysAttachment.copy("sys_property", gs.getProperty('propertyName'), "ZZ_YYincident", current.sys_id);
	current.imageField = sysId;

})(current, previous);

AnkurBawiskar_0-1694703257497.png

 

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

@luv2learn702 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader