How to set values dynamically in variables

Rani11
Tera Expert

Hi All,

Just a small query.

I have Variable which is referring to custom table.

Custom Table :

find_real_file.png

 

Role Display is Reference variable and above "Test Table" is used for reference. So When i select US-Store in the "Role Display" it should show relevant "US"country related location in the "Location" variable. here if US-STORE (then it is US country store. If they select (NZ-Store) then its is News Zealand country store.

find_real_file.png

 

So i tried script include and reference qualifier like below. But whatever i tried that is static one. I just wants to change that to dynamic one as per above logic. 

 

Script Include :

getLocation: function(role_display) {
var gr=new GlideRecord('cmn_location');
return 'country=Australia^u_active=true';
},

Reference Qualifier :

javascript:new LocUtils().getLocation(current.variables.role_display)

Its working as expected. but if i have one store then it should be fine but i have many stores. So i just wanted to change this to dynamic one. can anyone help me on this?

 

Thanks in Advance!!!

 

1 ACCEPTED SOLUTION

Rani11
Tera Expert

I have created script include and called the script include in the reference variable using advance.It worked .

Thanks all for your support.

View solution in original post

11 REPLIES 11

Ashok Kumar Am1
Giga Expert

I belive you can directly try below query in 'Reference qual', no need of script include.

javascript:'country='+current.variables.role_display+'^u_active=true'
Please try and let me know the result.

I had a similar need and that worked perfectly, thanks!

Rani11
Tera Expert

Hi Ashok,

Thanks for your response.

The country field is not present in my custom table. System does'not know US-Store((its only in custom table)) is US country store. Somewhere we have to say that US-Store is US .That is the reason i went to script include.

 

 

 

SanjivMeher
Kilo Patron
Kilo Patron

I would suggest creating a reference field to location in the Test Table. Because the store table should ideally store the location of the store.

And then use that field in the reference qualifier. Currently you are hard-coding the county, which is wrong.


Please mark this response as correct or helpful if it assisted you with your question.