In catalog task one variable is visible from the catalog item which in flow i have not selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have an order guide in which 2 catalog item is there. one is Pc purchase and 2nd is New hire. i have applied condition on variable when to show. For eg. if i am ordering from order guide some particular variables will be visible in pc purchase in sc_task and ritm. when i am standalone submitting the request for pc purchase not using order guide then the particular variables which is visible on order guide should not visible. but in catalog task one variable which i have hidden and in flow i have not selected , it is visible.why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If the variable is Global it will be shown in all Catalog Tasks, regardless of being selected in flow. This is controlled by a checkbox labeled 'Global' on the variable definition. You may also have a Catalog UI Policy or Catalog Client Script that is making it visible despite the hidden setting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
the logic which you are using to show/hide the variable on RITM form, apply the same on sc_task as well
share the client script & it's screenshots which is working fine on RITM.
Ensure "Applies on Catalog Task" is True for your script
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar , For hiding in ritm i have applied on load client script on ritm.I have attached screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I think it's normal client script on RITM table.
you can use similar logic in onLoad normal client script on sc_task
Is the above script working fine since you want to show/hide variables and syntax to access variable name is this
-> for sc_task this script should work
function onLoad() {
var ref = g_form.getReference('request_item', callBackMethod);
}
function callBackMethod(ref) {
if (ref.order_guide != '') {
g_form.setMandatory('variables.updated_new_hire_variables', false);
g_form.setMandatory('variables.seattle_office_onboarding', false);
} else {
g_form.setDisplay('variables.updated_new_hire_variables', false);
g_form.setDisplay('variables.seattle_office_onboarding', false);
}
}
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