How to use Template Value as table column
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 02:34 PM
Hi Everyone,
Our team came across a table in ServiceNow Share that had a column with type Template Value, which allows a user to choose different columns from a given table:
When we tried to replicate this, we get an Invalid Reference error:
Can someone provide some guidance on how to create a field type like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 01:29 AM
Hi Arjun,
Are you still looking for a solution to above?
If yes then please follow the steps below
1. Go to Field Class[sys_glide_object] table by typing sys_glide_object.LIST in the navigator.
2. In the list, filter using "Label contains template" and check if the visible value of the "template value" record is "false", as show below
3. If yes, then use the below background script to set it to visible
var glideObjGR = new GlideRecord("sys_glide_object");
//4ab89802c611229b0150036cde2dd741 --> sys_id of the "template value" record on sys_glide_object table.
if(glideObjGR.get("sys_id", "4ab89802c611229b0150036cde2dd741")){
glideObjGR.autoSysFields(false);
glideObjGR.setWorkflow(false);
glideObjGR.visible = true;
glideObjGR.update();
}
4. Once executed, you can see the "Template Value" field type available to use in Dictionary
Once you have created your field using the "Type", do remember to set the "Template Value" visible back to "false" as done below.
var glideObjGR = new GlideRecord("sys_glide_object");
//4ab89802c611229b0150036cde2dd741 --> sys_id of the "template value" record on sys_glide_object table.
if(glideObjGR.get("sys_id", "4ab89802c611229b0150036cde2dd741")){
glideObjGR.autoSysFields(false);
glideObjGR.setWorkflow(false);
glideObjGR.visible = false;
glideObjGR.update();
}
Thanks & Regards,
Rupam

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2021 11:56 AM
This is great stuff, Rupam.