Service Catalog Variable Default Value - Works in Catalog Item but breaks when in an Order Guide

Sarah50
Kilo Expert

I am using a simple javascript default value on a service catalog variable which works great:

javascript:sc_cat_item.u_configuration_item.getDisplayValue();

It grabs the CI (custom field) from the Catalog Item record of the item currently being ordered.

As soon as I attach the Catalog Item to an Order Guide, it no longer works and I'm sure it's because I have to dot.walk somehow through the order guide but I haven't found the correct syntax.

I've tried:
sc_cat_item_guide.sc_cart_item.u_configuration_item.getDisplayValue();
sc_cat_item_guide.cart_item.u_configuration_item.getDisplayValue();
current.cart_item.u_configuration_item.getDisplayValue();
current.sc_cart_item.u_configuration_item.getDisplayValue();

Anyone, know this? I urgently need the answer.

Thanks!!

3 REPLIES 3

Mark Stanger
Giga Sage

I think I fixed this issue for you. The dot-walk should work, but it won't work if the variable is part of a variable set (regardless of whether it's in an order guide). This is because variable sets are in a m2m relationship so you can't dot-walk there. You can set a default value in an onLoad client script with an asynchronous GlideRecord query.


Sarah50
Kilo Expert

Thanks Mark, yes I see that now - However, the dot-walk does work on that variable set when it's a standalone item.


It's probably some fluke then that it did. I don't know how this would ever work with a variable in a variable set...

javascript:sc_cat_item.u_configuration_item.getDisplayValue();

As long as the client script is working in both scenarios that's all that matters.