
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
11-23-2021 09:56 PM - edited 08-12-2024 09:08 AM
Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Hi there,
You are working on a Record Producer, and specifically multiple Select Box (Choice) Variables and trying to make these dependent on each other. Similar like for example, Category and Subcategory within the Incident form on the Platform UI. There are some community posts or articles out there describing how to achieve this, though… these are not multi-language! And there's an important attribute needed to get this working on all instances.
In this article I'll share how to create dependent Select Box Variables and having the Choices Multi-Language. This will be done with Lookup Select Box uses. In a later article, I'll do the same using Catalog Client Script and Script Include. Using a Catalog Client Script and Script Include is more complex as Lookup Select Box Variables, though will have a better performance.
Dependent Choices
What we are basically after, is the same as for example Category and Subcategory within the Incident form on the Platform UI. When changing the Category, the choices for Subcategory dynamically change.
Category Variable
The first step would be setting up a Variable for the Category. This will be a Variable of type Select Box. We will be re-using actual choices from within the Platform through the Choice table and Choice field.
Subcategory Variable
The second step would be setting up a Variable for the Subcategory. This will be a Variable of type Lookup Select Box. As Lookup from table we will use the Choice [sys_choice] table and the Lookup value field will be the Label. Using the Reference qualifier we can then create the actual dependency between the Category and Subcategory Variable.
Depending on how you named your variables, the Reference qualifier could be something like:
javascript:'name=incident^element=subcategory^dependent_value=' + current.variables.category;
I did notice that this setup does not work on all instances. For example on my Personal Developer Instance this does work fine, though at one of our customers no go. Adding Variable attributes "ref_qual_elements=category" did the trick. Haven't found out yet why it does work on my PDI without the Variable attributes.
Multi-language Choices
When testing this setup on a Multi-language instance, you will notice that the Subcategory will show all choices available irrespective of the language of the logged-in user. An instance with for example English and Dutch language plugins would show:
To have the Subcategory only showing choices in the language of the logged-in User, we need to expand the Reference qualifier on the Subcategory slightly, adding:
"^language=' + gs.getUser().getLanguage()":
Result
After having set up the Category and Subcategory Variables and having expanded the Reference qualifier, the result (in Dutch) should be something like below. A nice dependency between both variables and multi-language!
---
And that's it actually. Hope you like it. If any questions or remarks, let me know!
C |
If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.
Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in? |
Kind regards,
Mark Roethof
ServiceNow Technical Platform Architect @ Quint Technology
2x ServiceNow Developer MVP
2x ServiceNow Community MVP
---
- 16,456 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Nice write up,
Also instead of the addition to the ref_qual, you can also tick "unique values only" providing the "values" per language match, which will then render the choices that match the language of the user session

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Alex,
I did test a few weeks ago on Rome - Service Portal - Patch 1a, with lookup_unique checked, though no positive outcome with Lookup Select Box in combination with the Choice tabel selected.
Kind regards,
Mark

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Absolutely fantastic. Thank you for this!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Then how to depentent feild for subcategory to category
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
one more requirement has miss guide i am not pick mandatory but its reflect in catalog item while test its in mandatory could u plz say why?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank You!! I've been trying to get this to work for 2 days!! Adding the variable attribute fixed it.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Mark Roethof I've implemented similar type of choice dependency to one of my record producer variable. It is working as expected in the service portal. But when the record producer is loaded in platform view of service catalog category, this variable is not showing any choice except "none", when the dependent variable is selected with any choice.
Any thoughts?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you very much for publishing this solution; it helped a lot!!!
I had to add "req_qual_elements=category" to have it work out.