Reference qualifier with cilent script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 03:03 AM
I have cost center field (select lookup with reference to cost center table) and project category field (selectbox with manually entered values).
Cost center based on project category.
Example: scent (project category) has 3 cost center. It should only visible instead of showing the whole list.
I need reference qualifier with client script for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 09:40 AM
Hi,
yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 09:47 AM
Try below solution
- Create script include with below script :
var MyReferenceQualifierScript = Class.create();
MyReferenceQualifierScript.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getFilteredUsers: function(projectCategory) {
var costCenterSysIDs = [];
var prjGr = new GlideRecord('u_proj_category_costcenter_map');
prjGr.addQuery('u_project_category',projectCategory);
prjGr.query();
while(prjGr.next()){
var gr = new GlideRecord('cost_center');
gr.addQuery('active', true);
gr.addQuery('CostCenterFieldName',u_cost_center_name);
gr.query();
while (gr.next()) {
costCenterSysIDs.push(gr.sys_id.toString());
}
}return 'sys_idIN' + costCenterSysIDs.join(',');
},
type: 'MyReferenceQualifierScript'
});
- Update advanced reference qualifier as below:
javascript:new MyReferenceQualifierScript().getCostCenters(current.project_category);
If my answer has helped you then mark the solution as accepted, Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 10:21 AM
Hi,
it not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 10:25 AM
Please share your code or screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 10:51 AM
Hi,
I new to this task. So, please guide me to slove the requirement. Already I shared my code in this post.
Thank you for your time and effort.