The CreatorCon Call for Content is officially open! Get started here.

How to access Catalog item variable from Multirow variable set client script

Dush2
Tera Contributor

Hi all
I'm developing an scope app and I have come across a scenario where I must access a field value( Question) defined on the Catalog item say "Customer" from a client script of  Multirow variable set  and filter only the visitors belongs to that Customer.


Customer field on Catalog variables section


find_real_file.png

Based on the customers the visitor (reference field) of the Multirow variable set needs to be filtered and displayed.

find_real_file.png

Kindly share your advice how should I get the value of Customer field on to the client script of Variable set.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Dush 

you cannot access outside variables in ref qualifier of variable present in MRVS

but there is a workaround mentioned here; try that and enhance as per your case

SOLVED: Issue with MRVS multi row variable set accessing the form values

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Valmik Patil1
Kilo Sage

Hi Dush,

This is not supported for MRVS

Please refer below screenshot from documentation

find_real_file.png

Thanks,

Valmik

Ankur Bawiskar
Tera Patron
Tera Patron

@Dush 

you cannot access outside variables in ref qualifier of variable present in MRVS

but there is a workaround mentioned here; try that and enhance as per your case

SOLVED: Issue with MRVS multi row variable set accessing the form values

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Jorn van Beek
Tera Guru

issue is when useing g_form you access the g_form from the MRVS itself.

You can bypass this by placing a catalog client script on the item. with onload.

var g_form_item = g_form

now within the MRVS itself use the g_form_item as if you are on the form itself. Do something like:

var customer = g_form_item.getValue('customer');

<do rest of actions>

 

And yes, note this is not officially not possible, and yet it works.

Dush2
Tera Contributor
@Ankur Bawiskar and @Jorn van Beek  you both have given the correct answer which resolves my issue, Many thanks
Dush