How to access variables in client script of variable set within the same catalog item?

Sumit Rathod4
Tera Contributor

As many have already posted on the community to try,

g_form.getValue('variables.variable_name');

but I haven't seen any Accepted Solution marking this to be the correct answer.

Even I have tried it but it's not working for me.

I have even tried using just

g_form.getValue('variable_name');

but nothing is working for me.

Is there any solution to how to access variable in client script of variable set of type Multi Row Variable Set (MRVS) belonging to same catalog item on service portal.

I am trying to populate a variable in MRVS using variable set client script depending on a value of variable from record producer.

P.S I have this catalog item in Human Resources : Core

Since I want to access the variable in variable set, the 'Applies to' on the client script has been set to 'A Variable Set' and 'UI Type' is set to 'All'.

Please let me know solution to this issue.

8 REPLIES 8

Hi Sumit

can you please tell me if you have achieved this ?

Did you find the solution? 

jamal_williams2
Tera Contributor

You can use the g_service_catalog API:

 

g_service_catalog.parent.getValue("variable_name")

Adam43
Tera Contributor

similar issue here- but instead of mrvs, i'm on an order guide.

I have a variable set "request_information" with a variable "requested_for_agency" that's typically set with default value of javascript:gs.getUser().getCompanyID().

OUTSIDE the variable set on the order guide, i'm trying to use that requested_for_agency value to control what choices are available on a select box variable with a catalog client script.  I cannot seem to get a value to return for that agency value.  

i've tried many versions, here's one: 

 var requestedForAgency = g_form.getValue('variables.request_information.requested_for_agency');
is there any difference to what's allowed on order guides vs. normal catalog items as far as API's?  i've even tried just addressing directly with the g_form.getUser.getCompanyID() and it didn't work- wondering if my structure design is just faulty somehow?