- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have a requirement where a catalog variable job_number should:
Not be visible on Catalog Item or RITM (achieved by a Catalog UI Policy).
Be mandatory only on SC Tasks when:
Short description starts with "Create address book record"
Assignment group is ABC Group
What I tried:
Created a UI Policy on sc_task table with the below condition but no policy actions are given since its a catalog item variable.
Script used:
function onCondition() { g_form.setMandatory('job_number', true); g_form.setVisible('job_number', true); }But this UI Policy is not working for my variable.
In our instance, I have seen other similar configurations working fine, but not for this one.
Can anyone help me understand why my SC Task UI Policy is not working for this catalog variable? Do I need to make additional settings for the variable to be recognized on SC Task?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @Mahalakshmi Rav
the problem is you used a normal UI Policy on sc_task. Normal UI Policies can only control table fields. Catalog variables live in the Variable Editor, so they’re controlled by Catalog UI Policies / Catalog Client Scripts (with “Applies on Catalog Tasks” enabled), not by standard UI Policies.
Catalog Client Script (onLoad)
-
Create a Catalog Client Script tied to the Catalog Item.
-
Check Applies on Catalog Tasks.
-
onLoad script:
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/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @Mahalakshmi Rav
the problem is you used a normal UI Policy on sc_task. Normal UI Policies can only control table fields. Catalog variables live in the Variable Editor, so they’re controlled by Catalog UI Policies / Catalog Client Scripts (with “Applies on Catalog Tasks” enabled), not by standard UI Policies.
Catalog Client Script (onLoad)
-
Create a Catalog Client Script tied to the Catalog Item.
-
Check Applies on Catalog Tasks.
-
onLoad script:
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/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ravi Gaurav , This actually worked, Thank you 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Mahalakshmi Rav ,
Can you apply the visibility logic first and then set the field to mandatory (when the condition is true), It doesn’t make sense to make a field mandatory before it becomes visible.
UI Action should work in this case (it has access to both fields and Variables)
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
normal UI policy on table doesn't allow you to select variables in UI policy action.
In script please use this and it will work with your current UI policy
The syntax to use variable is this g_form.setMandatory('variables.variableName', true);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader