How to add icon in field control

guru_elearn
Kilo Expert

Hi,

I have to add an Help icon to each field on condition. Could you please let me know the procedure / steps to do this?

Thanks

Guru

1 ACCEPTED SOLUTION

Geoffrey2
ServiceNow Employee
ServiceNow Employee

It sounds like you need field_decorations (or ref_contributions), an attribute on the field that displays a UI Macro after the field.


See http://wiki.servicenow.com/index.php?title=Dictionary_Attributes#gsc.tab=0



Assume you want to add a help icon to the CI field ion an Incident when the Xfire CI is selected.


Find an icon image and add it to the Image gallery


Screen Shot 2016-08-31 at 9.55.08 PM.png



Create a UI Macro


Your condition for showing the icon is in the evaluate script here.


Screen Shot 2016-08-31 at 9.56.13 PM.png



Update the Attributes on the field in the Dictionary:


Screen Shot 2016-08-31 at 9.58.58 PM.png


Each attribute is separated by commas, and each value for one attribute is separated by semi-colons.



Please note that ref_contributions/field_decorations do not work on all field types.



The result is this


Screen Shot 2016-08-31 at 10.02.33 PM.png


Screen Shot 2016-08-31 at 10.02.48 PM.png


The icon will show when you save the form. You can use a Client Script to show it as soon as the field is changed.


View solution in original post

6 REPLIES 6

Hi Geoffrey.



Could you please give code in edit format so that I can copy


Hi Geoffrey,
 
Thank you for your answer. I've done the same for Caller ID on incident form. 
 
As per my requirement, we have one check box field on user table. whenever that field is checked then only this icon should display.
 
I've customized what you mentioned above. But, it is not working. It is displaying for all the persons. Please let me know how to fix this issue.
 
 
UI Macro:
 
find_real_file.png

 

Caller ID field attribute:

find_real_file.png

Please let me now your thoughts.

 

Thanks & Reagrds,

Prasanna Kumar