Dynamic field value for name of template table???

will_smith
Mega Guru

I have used javascript:gs.getUserID() before on fields, but is it possible to use that for all fields? I am looking for the template applied field in the template to dynamically fill with the name of the current template. Is this possible?

find_real_file.png

11 REPLIES 11

Ravi Prasad1
Tera Guru

It will be available only for reference fields .


will_smith
Mega Guru

Also, can you tell me where is info message is for attachments in Geneva? I want to adopt it in another environment.



find_real_file.png


William,



I'm afraid you can't, this logic seems to be running in the background at ServiceNow's site.



Stijn


Stijn Verhulst3
Kilo Guru

Hi William,



you can configure a Business Rule to automatically set the Template Applied field in the condition with the name of the current template. This would be a before update Business Rule (works as I verified it myself).



(1) I've added a new Fill Applied Template Field on the Template form:



find_real_file.png



(2) I've configured the Business Rule:



find_real_file.png



find_real_file.png



(3) I've created a new Applied Template string field on the incident form:



find_real_file.png



It's system name must be u_applied_template, otherwise you have to change the name in the script of the previously configured Business Rule. The system name of the field can be discovered by right-clicking on the label name of the field:



find_real_file.png



(4) Test and enjoy Upon saving your template, automatically the Applied Template & Name will be added to Template field; you no longer have to set it yourself. And when applying the actual template on an Incident, the Applied Template field will be filled in.



Future improvement could be to show the Fill Applied Template Field option on the Template form only in case the selected table is Incident for example; this could be done via an UI Policy.



Important note: I've did this on an OOB Fuji instance.



More information on Business Rules can be found here: Business Rules - ServiceNow Wiki



Kind regards,



Stijn