How to use a 'reference' field as an item selector in an Order Guide ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 09:31 AM
Hello everyone.
My question is about Script on an Order Guide.
I would like to use a variable (type: Reference) linked to the table "sc_cat_item" on the first step to add the item selected on the second step "Choose Options".
For example, as you can see on the screenshot, if i enter a catalog item on theses two variables, after i have click on NEXT, i can fill this two items on the step "Choose Options".
Thanks for your help !

- 2,045 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 08:14 AM
Yes but this not my point.
I'm not looking for cascade variables.
I would like to select a catalog item on a reference field and then this item will be add in the Options.
i tried this script but that did not works :
// Get the value "sys_id" of my variable field (reference type)
var value = g_request.getParameter('IO:13a97e561b4fcd184c16a938bd4bcb91');
// Add the catalog item filled on the variable reference type in the options.
guide.add(value);
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 01:01 AM
Hi
I'm still blocked !!
Can you help us ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2022 12:34 PM
Hi,
You can accomplish the above by using a script like this in your order guide script:
var gr = new GlideRecord('sc_cart');
if (gr.get(current.sys_id)) {
try {
var string = gr.getValue('current_guide_serial');
var val1 = string.split(/\r?\n/);
for (var i = 0; i < val1.length; i++) {
if (val1[i].indexOf('sys_id_of_cat_item_variable') > -1) {
guide.add(val1[i].split('=')[1].toString());
break;
}
}
} catch (e) {
}
}
Simply replace sys_id_of_cat_item_variable with the sys_id of the variable on the order guide that houses your catalog item reference field.
This works on both standard and service portal UIs.
Example, this is my order guide rule base:

But I want to dynamically add a catalog item based off a reference field on the order guide, such as:

Then in usage:


Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 05:54 AM
Hi Jeff,
I just wanted to check-in on this.
If my reply above also helped guide you Correctly, please also mark it as Correct.
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 06:43 AM
Hello
Thank you very much for taking the time to answer my problem.
It's always better to be several when faced with a problem that seems insurmountable.
Sorry for the late reply but I took the time to do my tests.
Unfortunately this script does not work for me.
I replaced "current_guide_serial" with the sysid of my reference type variable but when I select a value in this field and I do Next, it tells me the that there is no item to add in the options.
I don't understand what is not working !
And i don't know how find the problem...
Did you try this solution on your instance ?
Can you share an 'update set' of your works ?
Thanks a lot.
