Accessing other form variables from inside multi-row variable pop-up

Jamie Imms
Kilo Expert

Hello,

I am having trouble accessing other variables on a form from within the screen to add a row to a multi-row variable set.

If I run an onChange Client Script on a variable inside the multi-row variable, I don't seem to be able to access variables that are not in the multi-row variable.

Here is an example:

find_real_file.png

find_real_file.png

 

find_real_file.png

 

If I set the value in the Multi-Row Variable to "Yes", it should be printing out the value of the "Please Print Me" field in a field message, but it seems like I am unable to access it.

 

22 REPLIES 22

ryanlitwiller
Giga Guru

I've also run into the same issue. The MRVS is associated and dependant on a catalog item, in this regard I would consider the catalog item the parent of the MRVS and seems like we should be able to access g_form on the parent catalog item.

However, doesn't seem to be the case.

As a workaround on my parent catalog item, I'm setting an attribute on the NOW object that always seems to be accessible in ServiceNow via: 

this.NOW.[myAttributteName] = g_form.getValue("myfield");

then from the MRVS I can call upon the NOW object to get my needed value simply with:

this.NOW.[myAttributteName]

Hi Ryanlitwiller,

 

I am facing the similar issue. I have tried you way, but not able to accomplish it.

 

1. I have set this below attribute in the attribute field on the variable on the form.

this.NOW.[myAttributteName] = g_form.getValue("myfield");

 

 

2. Where can i write the below line and access the variables. Is it on attribute field of MRVS field or can i access in client script?

this.NOW.[myAttributteName]

 

 

Thanks

 

Harish Gubba

Hope you got this to work? Else use the format as: this.NOW.<any_attribute_name>

Example: this.NOW.myPartentVariable

I am having same issue, i have followed the steps which is mentioned on above, but am not able to resolve it.

Thanks @ryanlitwiller. This was really helpful!!