- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 12:59 AM
Hi,
I have a requirement as below.
1. There are 2 fields (Business Unit, Department). Both fields are getting values from Department table (cmn_department).
2. Business Unit is a Reference Field type
3. Department field is a lookup Select box type
4. Now I want to fetch department based on Business Unit field. And there are 4 Business Units after filtering out via reference qualifier. And each Business Unit having multiple Departments value in the Department table.
I have written a Client Script and a script Include to fetch the values as below :
Client Script:
Script Include:
But it's not working as per the plan, need help to fix my script.
Thanks,
Nipan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 01:40 AM - edited 05-18-2024 01:41 AM
Hi @Nipan1 ,
There is not need for Client Script & Script Include.
You can add reference qualifier in lookup select box variable.
Don't forget to add variable attributes.
Reference Qualifier : javascript:'business_unit='+current.variables.YourBusinessUnitVariableName;
Variable attributes: ref_qual_elements=YourBusinessUnitVariableName
I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 01:40 AM - edited 05-18-2024 01:41 AM
Hi @Nipan1 ,
There is not need for Client Script & Script Include.
You can add reference qualifier in lookup select box variable.
Don't forget to add variable attributes.
Reference Qualifier : javascript:'business_unit='+current.variables.YourBusinessUnitVariableName;
Variable attributes: ref_qual_elements=YourBusinessUnitVariableName
I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 10:41 PM
Hi @Community Alums,
Thanks for your response! The solution you provided works for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 01:58 AM
Hi @Nipan1 ,
You can write a reference qualifier and script include to return the values as below,
Reference qualifier:
javascript: new getBusiness().getdp(current.variables.businessUnit);
Script Include:
var getBusiness = Class.create();
getBusiness.prototype = {
// initialize: function() {},
getdp: function(businessUnit) {
gs.info('5'+ businessUnit);
var gr = new GlideRecord('cmn_department');
gr.addQuery('business_unit',businessUnit);
var arr =[];
gr.query();
while(gr.next()){
arr.push(gr.getValue('sys_id'));
}
gs.info('arr' + arr.toString());
return 'sys_idIN' + arr;
},
type: 'getBusiness'
};
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 10:40 PM
Hi @swathisarang98 ,
Thanks for your response! I appreciate your input.