Acessing variables in Advanced Reference Qualifier from a variable set

Javi2
Kilo Contributor

I have a Record Producer with this structure.

Record Producer{

         Variable 1

         Variable Set {

                  Variable 2

         }

}

 

Variable 1 is inside the record producer but Variable 2 is in a variable set. I want to use variable 1 value to filter Variable 2 using an advanced  reference qualifier but 'current.variables' refers to the variables in the variable set so I can't access variable 1.

 

Is there any way to achieve this?

 

Edit: This is a multi-row variable set.

 

1 ACCEPTED SOLUTION

Not sure if Variable 2 is the one that needs the reference qualifier, but according to the documentation Service catalog variable sets:

Note:

  • onSubmit catalog client scripts are not supported for a multi-row variable set.
  • Catalog UI policies and catalog client scripts defined at the item level are not applicable for variables in a multi-row variable set. Only those catalog UI policies and catalog client scripts defined within the multi-row variable set are applicable for variables in the multi-row variable set.
  • Scripts that are not included in a multi-row variable set cannot affect variables inside the multi-row variable set. Similarly, the scripts included in the multi-row variable set cannot affect the variables that are not included in the multi-row variable set.
  • 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 may be why it is not working.

View solution in original post

12 REPLIES 12

Not sure if Variable 2 is the one that needs the reference qualifier, but according to the documentation Service catalog variable sets:

Note:

  • onSubmit catalog client scripts are not supported for a multi-row variable set.
  • Catalog UI policies and catalog client scripts defined at the item level are not applicable for variables in a multi-row variable set. Only those catalog UI policies and catalog client scripts defined within the multi-row variable set are applicable for variables in the multi-row variable set.
  • Scripts that are not included in a multi-row variable set cannot affect variables inside the multi-row variable set. Similarly, the scripts included in the multi-row variable set cannot affect the variables that are not included in the multi-row variable set.
  • 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 may be why it is not working.

Javi2
Kilo Contributor

Thanks! Seems that it's impossible to do then. I'll try alternative ways of doing this.

I was looking for a way to do this too...

 

I'm thinking that a relatively jank way to get this done might be:

 

Client script on the record producer makes a GlideAjax call to set a system property to the variable 1 value.

Script include being used in the reference qualifier for variable 2 can access the value in the system property.

 

I don't like the fact that this may be one of the few ways to get this done... but it's an idea anyway.

Hello,

I know it has been 3 years, but i found a way around this and it's pretty simple. 🙂

In this example i needed the company sys id from the parent form to use as a Reference Qualifier in my Multi-row variable set.

Step 1

Create an extra variable in your Multi-row variable set. For example companyID. This field can be hidden (see step 2)

Step 2

Create a new client script (onLoad) in your Multi row variable set . For example:

function onLoad() {
  
	//Get company ID from parent form
	var companyID = parent.g_form.getValue('variables.company');
	
	//Set company ID to field
	g_form.setValue('companyid', companyID);
	
	//Hide company ID field
	g_form.setDisplay('companyid', false);

}

Step 3

You can now use this hidden field as a Reference Qualifier. For example: javascript:'company=' + current.variables.companyid + ';

 

I hope this helps!

Kind Regards,

 

Stefan

Stefan42
Tera Expert

Hello,

I know it has been 3 years, but i found a way around this and it's pretty simple. 🙂

In this example i needed the company sys id from the parent form to use as a Reference Qualifier in my Multi-row variable set.

Step 1

Create an extra variable in your Multi-row variable set. For example companyID. This field can be hidden (see step 2)

Step 2

Create a new client script (onLoad) in your Multi row variable set . For example:

function onLoad() {
  
	//Get company ID from parent form
	var companyID = parent.g_form.getValue('variables.company');
	
	//Set company ID to field
	g_form.setValue('companyid', companyID);
	
	//Hide company ID field
	g_form.setDisplay('companyid', false);

}

Step 3

You can now use this hidden field as a Reference Qualifier. For example: javascript:'company=' + current.variables.companyid + ';

 

I hope this helps!

Kind Regards,

 

Stefan