- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:27 PM
We are working with the new Order Guide in Kingston and we have about 22 Items we want to include in the Order Guide that we are creating. I cannot find a place to have all the 22 catalog items that show up on the Choose Option page to have the toggle switch default to Off instead of On. Anyone have any ideas on how to toggle them all Off when the screen loads so the person filling out the form has to check them all? See screenshot below - I marked the toggle switch I'm talking about with a red box
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 05:15 PM
I decided to give this a go with editing the widget and found it really wasn't too bad to do it. You'll still have to own the cloned version of the widget, but the original will still upgrade for you to merge with after an upgrade. Here's how you can accomplish this...
1) Create a new field True/False field on the 'sc_cat_item_guide_items' table (this is the table in the Order Guide rule base related list). Make sure to name the field 'Toggle off default' and then you can re-label however you want. We just want the field name to match what I've got in the script below. You can then check this field if you'd like the toggle to be off for a particular rule base option by default.
2) Clone the 'SC Order Guide' widget and modify the 'Server Script' portion of the widget to include the following code immediately after the 'item.included = true;' line.
// Query for the order guide rule base for this item to determine if it should be on or off by default
var ogr = new GlideRecord('sc_cat_item_guide_items');
ogr.addQuery('guide', $sp.getParameter("sys_id"));
ogr.addQuery('item', item.sys_id);
ogr.query();
if (ogr.next()) {
if (ogr.u_toggle_off_default == true) {
item.included = false;
}
}
3) Replace the 'SC Order Guide' widget with your new widget on the 'Order Guide' page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 03:52 PM
I really tried to find a solution for you on this one, but it looks like it's just not possible unless you want to take ownership of the entire widget. I wouldn't advise that at all, especially since this is a very new piece of functionality and very likely to change in the next several releases.
Technically this is possible though if you wanted to take ownership of the entire order guide widget. Here's how I would suggest structuring this if someone wanted to make the (somewhat difficult) attempt in spite of the risks.
1) Create a new field on the order guide rule base table named 'Include by default'. This field would default to 'true' as I think that's still the best default behavior. Putting this field on the rule base table would allow you to configure this for different items on different order guides independent of one another.
2) Clone the 'SC Order Guide' widget and adjust the 'Server Script' and 'HTML Body Template' fields to perform an additional query against the item rule base to determine (and set) the default indicator for each and every item.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 05:15 PM
I decided to give this a go with editing the widget and found it really wasn't too bad to do it. You'll still have to own the cloned version of the widget, but the original will still upgrade for you to merge with after an upgrade. Here's how you can accomplish this...
1) Create a new field True/False field on the 'sc_cat_item_guide_items' table (this is the table in the Order Guide rule base related list). Make sure to name the field 'Toggle off default' and then you can re-label however you want. We just want the field name to match what I've got in the script below. You can then check this field if you'd like the toggle to be off for a particular rule base option by default.
2) Clone the 'SC Order Guide' widget and modify the 'Server Script' portion of the widget to include the following code immediately after the 'item.included = true;' line.
// Query for the order guide rule base for this item to determine if it should be on or off by default
var ogr = new GlideRecord('sc_cat_item_guide_items');
ogr.addQuery('guide', $sp.getParameter("sys_id"));
ogr.addQuery('item', item.sys_id);
ogr.query();
if (ogr.next()) {
if (ogr.u_toggle_off_default == true) {
item.included = false;
}
}
3) Replace the 'SC Order Guide' widget with your new widget on the 'Order Guide' page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2020 06:47 PM
Hi I have a similar requirement but an specific catalog item must be always there, the idea is to not allow users to use the toggle for that specific item, your script works but only defaulting the value of the item with u_toggle_off_default == true , I'm trying to either hide the toggle or set disabled but I wasn't able to make it so far.
I've tried adding the disabled directive on the widget but still no luck.
< input type="checkbox"
ng-model="item.included"
tabindex="0"
aria-label="${Included}"
id="enable_switch_{{::item.sys_id}}"
ng-readonly="item.disable_toggle"
/>
Server script
var ogr = new GlideRecord('sc_cat_item_guide_items');
ogr.addQuery('guide', $sp.getParameter("sys_id"));
ogr.addQuery('item', item.sys_id);
ogr.query();
if (ogr.next()) {
if (ogr.u_toggle_off_default == true) {
item.included = "false";
item.disable_toggle = "true";
}
}
But still get the same result, the toggle/switch display all gray out but users are able to change it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018 10:44 AM
Thank you so much for the help - you gave me exactly what I needed!!!