- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2022 05:23 AM
Hi Team,
I have field named Category which is a reference type field, referencing table contains two fields: Category and Plant. I have another Field called Plant Name in the current table, it is also a reference type field. By selecting the plant name, I need the records for category in which the selected plant name matches with the Plant which is there in Category table.
Current Table:
Category Table:
Is there any suggestion, how to achieve this?
Thanks,
Yesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2022 09:59 PM
Hi
Please create a new script include with the following function, also make sure its client callable:
getCategory: function(plant) {
var refQuery = '';
refQuery = 'category=plant';
return refQuery;
},
After this, use advanced reference qualifier and use the below code for calling your script include:
javascript: yourScriptIncludeName().getCategory(current.variables.plantName);
However, if its a scoped application, then you will have to append the application name before yourScriptIncludeName() in reference qualifier
Note: Make sure that you change the variable name as per the name in your system.
Mark as correct if helpful!
Thanks,
Nikhil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2022 06:19 AM
Hi,
You can achieve this using advanced ref qualifier. Create a script include which will return the values for Category that matches the current Plant Name. call that script inlcude in ref qualifier.
Also your Plant name field looks like a choice field and not a ref, can you confirm
Please mark helpful/correct if this helped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2022 08:59 PM
Hi Tapish,
The plant name field is a Reference field with choice.
Thanks,
Yesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2022 09:23 PM
Hi
I have tried creating a script include and calling it in the reference qualifier. The script is returning a single record. Can you help me out with the script?
uniqueCat: function(plant) {
var pList = [];
var plan = new GlideRecordSecure('x_rfq_module_categories');
plan.addQuery('u_plant', plant);
plan.query();
while(plan.next()) {
gs.addInfoMessage(plan.u_category);//here i am getting all categories which are matched with plant name
pList.push(plan.sys_id);
}
return 'sys_idIN' + pList.toString();//only returning the last record
}
Thanks,
Yesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2022 06:27 AM
Hi Yesh,
You can achieve this by advance reference qualifiers.
Try adding the below code.
javascript:"plant=" + current.variables.plant_name;
Please let me know if you are seeking someting more in it.
Please mark my answer correct/helpful as applicable!
Regards,
Rahul
Thanks and Regards,
Rahul