- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2021 09:02 AM
Hi,
My question seems pretty basic I guess but I need to be able to display some variables only on specific catalog tasks.
I guess I'll have to deal with catalog UI policies but I don't know where to start with this.
For example, in one catalog task I want to have this question "Do you validate the quote ?", but only in this particular CT, not anywhere else.
Is there a specific javascript chunk of code to write or it's simpler than that ?
Thanks.
Solved! Go to Solution.
- Labels:
-
Cost Management (ITSM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2021 09:09 AM
Hi,
While creating Catalog Task from workflow you can ensure you show only the variables you want to be visible.
This can be done by selecting variables from Available to Selected section
OR
Sample script below if those variables are present on more than 1 task and you want to show only for 1
function onLoad() {
//Type appropriate comment here, and begin script below
var shortDescription = 'Your Task Short Description for which it needs to be visible';
if(g_form.getValue('short_description') != shortDescription){
// if that variable is mandatory then make it non-mandatory first
g_form.setDisplay('variableNane', false);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2021 09:05 AM
Hi,
you can create onLoad Catalog Client Script or Catalog UI Policy which
Applies to Catalog Task - true
In Catalog UI Policy condition check the task short description is not your specific task description
Based on that add Catalog UI Policy Action and make the variables display = false
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2021 09:09 AM
Hi,
While creating Catalog Task from workflow you can ensure you show only the variables you want to be visible.
This can be done by selecting variables from Available to Selected section
OR
Sample script below if those variables are present on more than 1 task and you want to show only for 1
function onLoad() {
//Type appropriate comment here, and begin script below
var shortDescription = 'Your Task Short Description for which it needs to be visible';
if(g_form.getValue('short_description') != shortDescription){
// if that variable is mandatory then make it non-mandatory first
g_form.setDisplay('variableNane', false);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2021 05:05 AM
Hi Ankur,
I have another related question to this.
This specific variable is also present on the order form, and I don't want it there but only visible in the catalog task.
How to hide it from the order form ?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2021 09:00 PM
Hi,
then create catalog client script or catalog UI policy which works on Catalog Item view only and then hide it
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader