Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Creating a Dynamic Filter for HR SKills

GillianH
Tera Contributor

Hi all,

I'm trying to give agents a filter that reads "show me cases tagged with any of the skills on my own user record" — essentially a dynamic filter 'Skills is one of my skills'.  The operator does appear on the Skills field, so the option is binding. But after running the filter on a case list, the value renders null instead of One of My Skills. This happens for users with multiple skills, and in both native UI and Agent Workspace. 

the setup of skills field is:

Property Value
Tabletask (filtering child sn_hr_core_case)
Fieldskills
Typeglide_list
Referencecmn_skill
with the following script include:
var MySkillsFilter = Class.create();
MySkillsFilter.prototype = {
    initialize: function() {},

    getMySkills: function() {
        var skills = [];
        var gr = new GlideRecord('sys_user_has_skill');
        gr.addQuery('user', gs.getUserID());
        gr.addQuery('active', true);
        gr.query();
        while (gr.next())
            skills.push(gr.getValue('skill'));

        return skills.length ? skills : ['-1'];
    },

    type: 'MySkillsFilter'
};
 
The dynamic filter option record all looks correct, i believe the issue lies with the script include. Any guidance is greatly appreciated! 
 

 

0 REPLIES 0