
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2015 02:46 PM
I have a variable set: Contact Info that is applied to every item in my service catalog. I have a variable within this set called Ship_to. I only want Ship_to to be visible and mandatory if the items billable(sc_cat_item_billable) flag is true.
I have tried multiple client scripts and UI policies but have not gotten any to work yet. Has anyone been able to accomplish this before?
Thanks,
Teri
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2015 09:36 PM
This may sound a little odd, but it works. I'm assuming here that "Ship_to" is visible and mandatory by default.
1. Create a new Variable Set called "Hide Ship To" (or whatever)
2. Create a new "onLoad" Client Script with the following settings:
Applies to: Variable Set
Variable set: Hide Ship To
Applies on a Catalog Item view: checked
Applies on Requested Items: checked
Applies on Catalog Tasks: checked
Script:
function onLoad() {
try{
g_form.setMandatory("variables.Ship_to", false);
g_form.setDisplay("variables.Ship_to", false);
} catch(err) {}
}
Add the new Variable Set to each Catalog Item where you want the field hidden. No actual Variables are required in the Variable Set.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2015 03:54 PM
Sounds like a Catalog UI Policy should work in this case. When you tried Catalog UI, what happened? Can you attach a screen shot?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2015 05:25 PM
I have found that the 'Show Related Fields' does NOT work in the condition fields on UI Policies.
A work around until SNow gets the 'Show Related Fields' to work is as follows:
Use a catalog Client Script - OnLoad
Get the item Sys_id using - var sys_id = g_form.getParameter("sysparm_id");
Call Script Include to get the catalog Item billable field
Use g_form.setDisplay() to display field when required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2015 09:36 PM
This may sound a little odd, but it works. I'm assuming here that "Ship_to" is visible and mandatory by default.
1. Create a new Variable Set called "Hide Ship To" (or whatever)
2. Create a new "onLoad" Client Script with the following settings:
Applies to: Variable Set
Variable set: Hide Ship To
Applies on a Catalog Item view: checked
Applies on Requested Items: checked
Applies on Catalog Tasks: checked
Script:
function onLoad() {
try{
g_form.setMandatory("variables.Ship_to", false);
g_form.setDisplay("variables.Ship_to", false);
} catch(err) {}
}
Add the new Variable Set to each Catalog Item where you want the field hidden. No actual Variables are required in the Variable Set.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2015 08:37 AM
Hi Jim, this was a perfectly simple and brilliant solution! It worked like a charm...I just wished I had asked prior to trying a hundred different ways to get this to work... I would have never thought of this solution.
Thank you!!
Teri