Dynamically Use Catalog Item Variable in Reference Qualifier of MRVS Variable

jmiskey
Kilo Sage

I am creating a Multi-Row Variable Set (MRVS) that will be used in multiple Catalog Items, so I am trying to make it as dynamic as possible.

I have an "Environment" in my MRVS that will need to be filtered based on which application it is for.  I have stored the sys_id of the Application record in a Variable in the main Catalog Item (I know I can hard-code it in the MRVS, but then it would not be dynamic!).

So my "Environment" field in my MRVS is a Reference field, and this is what it looks like:

find_real_file.png

My "application_sys_id" field is at the Catalog Item level, and is a Single Line Text field.  I have put the value it needs to be in the "Default" field on this variable, i.e. 7eb3fe1d1...

Now, if I hard code my "Reference qual" like this:

javascript: 'u_active=true^u_application=7eb3fe1d1…'

It works exactly as it should, but it does NOT if I try to use current.variables...  I tripled-checked, to make sure that there are no typos in my variable name, and it is correct (so please don't suggest I check that).

I did further tests, to see what would happen if I created the application_sys_id variable right in the MRVS, and it worked fine when I did it there (but defeats the whole dynamic goal).  But what that does tell me is that the MRVS does not like to use current.variables... to try to get a variable from the Catalog Item that is using that MRVS.

So, the question then becomes, how can I have my variables in MRVS call variables from the Catalog Item that is using them?

Thanks

 

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

The short answer is you can't.  A workaround would be to add a variable to the MRVS that is a reference on the same table as the catalog item variable, then you can have an onLoad script within the MRVS populate the MRVS variable from the catalog item variable, and make it read only.  In Quebec and later you will be able to hide this extra variable, and may not even need it as the interaction between the MRVS and catalog item is said to be improved, but I don't know if this specific use case is addressed.

View solution in original post

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

The short answer is you can't.  A workaround would be to add a variable to the MRVS that is a reference on the same table as the catalog item variable, then you can have an onLoad script within the MRVS populate the MRVS variable from the catalog item variable, and make it read only.  In Quebec and later you will be able to hide this extra variable, and may not even need it as the interaction between the MRVS and catalog item is said to be improved, but I don't know if this specific use case is addressed.

Prasad Pagar
Mega Sage
Hi, Variables that are not included in a multi-row variable set cannot be used in dependent reference qualifiers for variables in the multi-row variable set. Similarly, the variables included in the multi-row variable set cannot be used in dependent reference qualifiers for variables that are not in the multi-row variable set. For a reference qualifier, the current row is the one that is being edited. This is official from ServiceNow. I dont think its possible. Thank you Prasad

jmiskey
Kilo Sage

I was afraid that might be the case.  I had tried using a Script Include too, but that did not work either (as you probably would have guessed!).

Thanks for the replies.