Catalog builder - templates and custom fields

Eli Guttman
Tera Guru

Hi,

We are looking into proving catalog builder roles for few users - few questions:

 

1. If a certain catalog item as created in the standard way (not using the catalog builder) - and i would like to provide process owner the ability to edit it - how can i control the template he will use? for example, i would like him to be able to edit only the item name, short description, description - but not the attached flow / category.

 

2. I saw that we can create custom fields and added them to the template - but it seems like we can add fields that will be mapped directly to fields on the catalog item table, can we add field and map them ( maybe using scripts) to other components related to the catalog item? for example: taxonomy ( in employee center) or UF activity (using the flow designer universal flow application).

 

 

3 REPLIES 3

Ravi Gaurav
Giga Sage
Giga Sage

If you want to control the template that a process owner uses to edit a catalog item that was not created using the catalog builder, you can create a catalog item template that includes only the fields that you want the process owner to be able to edit. Then, you can use the "Apply Template" functionality in the catalog item form to apply the template to the catalog item. This will remove any fields that are not included in the template from the form, so the process owner will only be able to edit the fields that are allowed.
To create a catalog item template, go to "Catalog Items" in the Service Catalog application, then click "Catalog Item Templates" in the left-hand navigation menu. From there, you can create a new template and add the fields that you want to include. Once you have created the template, you can apply it to a catalog item by opening the catalog item form, clicking the "More options" button (three dots) in the top right corner, and selecting "Apply Template".

When you create custom fields in the catalog builder, you can map them to fields on the catalog item table or to other related tables using scripts. To do this, you can use the "Advanced" tab in the custom field configuration dialog to specify a script for the "Reference qualifier" or "Default Value" fields.
For example, if you want to map a custom field to the taxonomy field in Employee Service Center, you can use a reference qualifier script to limit the options in the field to those that are valid for the selected taxonomy. Here is some example code:

function getValidCategories() {
// Get the selected taxonomy from the catalog item
var taxonomy = current.variables.taxonomy;
// Query the taxonomy categories table to get the valid categories
var categoryGr = new GlideRecord('taxonomy_category');
categoryGr.addQuery('taxonomy', taxonomy);
categoryGr.query();
// Build an array of valid category sys_ids
var validCategories = [];
while (categoryGr.next()) {
validCategories.push(categoryGr.sys_id);
}
return validCategories.join(',');
}

// Set the reference qualifier for the custom field to the valid categories for the selected taxonomy
current.variables.my_custom_field.setReferenceQualifier(getValidCategories());

Similarly, if you want to map a custom field to a UF activity in Flow Designer, you can use a default value script to set the value of the field to the sys_id of the activity. Here is some example code:

// Get the sys_id of the UF activity
var activityGr = new GlideRecord('u_flow_activity');
activityGr.addQuery('name', 'My Activity');
activityGr.query();
if (activityGr.next()) {
var activitySysId = activityGr.sys_id;
// Set the default value of the custom field to the sys_id of the activity
current.variables.my_custom_field = activitySysId;
}
Note that you will need to adjust the example code to match the specific field names and table names in your ServiceNow instance. Also, keep in mind that custom scripts can impact system performance, so make sure to test thoroughly and follow best practices for optimization.


If my answer solved your issue, please mark my answer as ‌‌ Correct & ‌‌Helpful based on the Impact.

 

Thanks

Ravi Gaurav

 

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Eli Guttman
Tera Guru

Thank you Ravi for all the information!

 

1. Regarding creating template - do you refer to the catalog builder UI or to the standard UI - i saw how to created in the builder UI, but i don't see the menus you mention in the standard UI - i also don't see apply template option - do you refer to the template option we have for any table or something specific for Service catalog? i saw a field on the catalog item table called "Associated template" that can be used to set the relevant template.

 

2. Regarding my second question - i would like the person who is using the builder to provide as input the assignment group of the task (for example) - but this need to be updated in a related list, not in a field on the catalog item form. can i use the default value script to insert a record in a related list? is that what you meant?

Hey @Eli Guttman , Hope you are doing good.

I am also having similar kind of requirement.  Have you found the answers to your questions already ?