Reference field variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 07:51 AM
I have two reference field variables . They both point to same table . Variable A has 10 records , variable B options should be displayed based on selected choice in the variable A .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 09:25 AM
Hi @Jude8 ,
Please refer to below thread:
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 11:11 PM
I have tried it but didnt work. I have created 2 custom tables and i have two ref variables in catalog item. variable A refers to Custom table A , Variable B refers to custom table B . Custom table B has a reference field with custom table A.
whenever variable A is selected , variable B should display choices based on var A. Can you help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2024 01:04 AM
Hi @Jude8
please try the below code and make modifications to your requirement
you can pass this ref qual in second variable
javascript: new scriptincludeName().YourFunctionName(current.variables.variable_a);
Script include:
YourFunctionName: function(service) { // service is your first selected variable-a
var filterStr = '';
var gr = new GlideRecord("your_table");
gr.addQuery('field', service);
gr.query();
var pArray = [];
while (gr.next()) {
pArray.push(gr.fieldname.toString());
}
filterStr = 'sys_idIN' + pArray.toString();
return filterStr;
},