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

Variable reference field in service catalog

harishdasari
Tera Guru

Hi,

I have 2 variables   on the catalog form. Both are of reference type.

Oss form to be modified variable is reference of "sc_cat_item" table.      

Please identify the collection list variable is reference of question table.

Now when user select the catalog form from the 'oss form to be modified' variable, then 'please identify the collection list' variable should should fetch only the List collector related variables.

Here I am able to filter as shown in screenshot, But issue is I need to restrict the list collector variables to pop-up only from the related form that user selected in "Oss form to be modified" variable.

find_real_file.png

find_real_file.png

please let me know, anyone can provide solution for this.

Thank you.

1 ACCEPTED SOLUTION

Maniraj Jayaraj
Tera Expert

Hi Harish,



First Use Variables table instead of Question table.



secondly ,If you want your 2nd variable to db dependent on the 1st one...then use Advance Qualifying condition.



find_real_file.png



Select Advance in Use reference Qualifier



and specify the condition like,



javascript:'type=21^cat_item=' + current.variables.<oss-variable-name>.



Thanks,


Mani


View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Harish,



This won't work directly.



My assumption is as follows what you require.


if user selects catalog item A then in the second variable all the variables of type as list collector belonging to the catalog item A should be shown



Also your second field is a reference to table 'item_option_new' i.e. Variables.



you need to use advance ref qualifier and call script include as follows



javascript: new filterVariables().getVariable(current.variables.<oss_field>);



script include



function getVariable(catalogItemSysId){



var encodedQuery = 'typeIN21^cat_item=' + catalogItemSysId;



var arr = [];


var gr = new GlideRecord('');


gr.addEncodedQuery(encodedQuery);


gr.query();


while(gr.next()){


arr.push(gr.sys_id.toString());


}



return 'sys_idIN' + arr;


}




Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

Maniraj Jayaraj
Tera Expert

Hi Harish,



First Use Variables table instead of Question table.



secondly ,If you want your 2nd variable to db dependent on the 1st one...then use Advance Qualifying condition.



find_real_file.png



Select Advance in Use reference Qualifier



and specify the condition like,



javascript:'type=21^cat_item=' + current.variables.<oss-variable-name>.



Thanks,


Mani


harishdasari
Tera Guru

Hi Ankur and Maniraj,



Thank you for the Help, Both of your solutions are working good.



But there is only one choice to select correct answer



Thanks