How to call catalog item variable?

ak4
Tera Contributor

How to call catalog item variable?

7 REPLIES 7

SaeS
Tera Contributor

it's perfect 

current.variables.variable_name

sriram35
Kilo Guru

Hi,

 

If you are using in the Business rule or Script Include you can use below code

current.variables.variable_name

 

Hope this helps!

If I have answered your question, please mark my response as correct and/or helpful.

Thanks,

Sriram

DirkRedeker
Mega Sage

Hi

If you have a GlideRecord on a Requested Item Record (table [sc_req_item]), you can access the variables with dot-walk notation like shown in the example below.

Assume, you have two Catalog Variables attached to your Catalog Item.

When you check out this item from the cart, the resulting Requested Item (RITM),
will hold the contents of the variables.

Assume, your variables are called "var1" and "var2, you can access them like shown below.

var gr = new GlideRecord('sc_req_item');

gr.addQuery('number', 'RITM0011223');
gr.query()

if (gr.next()) {
   gs.info(gr.variables.var1;
   gs.info(gr.variables.var2;
}

This works in SERVER side scripts, like in Workflow Activities, Business Rules, etc.
YOu can also test this in "Scripts - Background" if you like to.

Just tale the script above, and change the RITM number to your number.

Let me know if that answers your question and mark my answer as correct and helpful.

Enjoy & BR

Dirk