Variable to be hidden in RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
the variable 'by submit' created for the task when select option Type A is selected has to be visible and mandatory but not when TYPE B . At the same time when type B is selected and task is created for it along with the RITM then the variable 'by submit' should not be visible over the RITM of the type B selection. How to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @chinagudish
Try this:
- Navigate to your Catalog Item and scroll to the Catalog UI Policies related list > Click New
- fill in the following:
- Applies to: A Catalog Task [sc_task]
- Applies on Catalog Item view: Leave unchecked.
- Conditions: Type is Type A.
- Save the UI Policy.
- Scroll to the Catalog UI Policy Actions related list and click New:
- Variable name: by_submit
- Visible: True
- Mandatory: True
- Navigate to your Catalog Item and scroll to the Catalog UI Policies related list > Click New
- fill in the following:
- Applies to: A Catalog Task [sc_task] .
- Applies on Catalog Item view: Leave unchecked.
- Conditions: Type is Type B.
- Save the UI Policy.
- Scroll to the Catalog UI Policy Actions related list and click New:
- Variable name: by_submit
- Visible: False
- Mandatory: False
3) Hide the Variable on the RITM
On your Catalog Item> Catalog Client Scripts related list > click New.
Configure the script:
Type: OnLoad
Applies on Requested Items: True
function onLoad() {
var itemType = g_form.getValue('type'); // replace your actual variable name
if (itemType == 'type_b') // // replace your actual variable Value
{
g_form.setDisplay('by_submit', false);
}
}
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @chinagudish,
You can achieve this without customization by using separate Catalog UI Policies.
Catalog Task (sc_task)
Create a Catalog UI Policy that applies to Catalog Task.
Condition: Type = Type A
by_submit → Visible = true, Mandatory = true
Create another policy for Type = Type B
by_submit → Visible = false, Mandatory = false
Requested Item (sc_req_item)
Create another Catalog UI Policy with Applies on Requested Items enabled.
Condition: Type = Type B
Add a Catalog UI Policy Action:
by_submit → Visible = false, Mandatory = false
This keeps the behavior consistent on both the Catalog Task and the RITM without relying on client-side scripting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
so what script did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
I tried catalog client script on Load and On change ,it did not work . Ieven followed the above approaches but nothing seems to be working.