Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

SkillDeterminationUtils- Scoped

The SkillDeterminationUtils script include provides utility methods to get or set work item skill data.

This script include requires the Skill Determination (com.snc.skill_determination) plugin and is provided within the sn_skill_rule namespace.

Parent Topic:Server API reference

SkillDeterminationUtils - SkillDeterminationUtils()

Constructor to create an instance of SkillDeterminationUtils.

NameTypeDescription
None  
var util = new sn_skill_rule.SkillDeterminationUtils();

SkillDeterminationUtils - assignSkillsToWorkItem(Array skills, GlideRecord now_GR)

Assigns an array of active skill objects to a work item.

NameTypeDescription
skillsArrayArray of active skill objects to be assigned.
skill.skillNameStringName of the skill.
skill.skillSysIdStringSys ID of the skill.
skill.mandatoryBooleanTrue if the skill is mandatory, false otherwise.
skill.skillLevelNameStringOptional skill level name.
skill.skillLevelSysIdStringOptional skill level Sys ID.
now_GRGlideRecordGlideRecord of the work item on which to assign skills.
TypeDescription
None 

The examples below create an Interaction record using the table name (interaction) and show how to assign skills to the interaction work item, creating a record in the Interaction Skills [interaction_m2m_skill] table.

Use case 1: Use returned results from determineWorkItemSkills() to assign skills to a work item from the Interaction table.

// Create an interaction record
var now_GR = new GlideRecord('interaction');
now_GR.insert();

var util = new sn_skill_rule.SkillDeterminationUtils();

// Get interaction skills interaction 
// and specify if any are mandatory
var result = util.determineWorkItemSkills(now_GR);

// Assign skills determined by result and 
// assign them to the interaction work item
util.assignSkillsToWorkItem(result, now_GR);

Use case 2: Manually insert skills array. In this case, assign IT skills to the Interaction work item.

var now_GR = new GlideRecord('interaction');
now_GR.insert();

var util = new sn_skill_rule.SkillDeterminationUtils();

var skills = [{"skillSysId":"2eb1c2029f100200a3bc1471367fcfe4", "skillName":"IT", "mandatory":true, "skillLevelName":"", "skillLevelSysId":null}];

util.assignSkillsToWorkItem(skills, now_GR);

SkillDeterminationUtils - determineWorkItemSkills(GlideRecord now_GR)

Gets skills for a specified work item, indicates if the skills are mandatory, and lists any skill levels.

NameTypeDescription
now_GRGlideRecordGlideRecord of a work item from any interaction or task table extension.
TypeDescription
ArrayOne or more skill objects.- skillSysId: String. Sys ID of the skill from the Skills \[cmn\_skill\] table. - skillName: String. Name of the skill. - mandatory: Boolean. True if mandatory, false otherwise. - skillLevelName: If skill exists, name of the skill level. - skillLevelSysId: If skill exists, Sys ID of the skill level from the Skill Levels \[cmn\_skill\_level\] table.

The following script creates an interaction record, gets skills for the interaction work item, and indicates if the skills are mandatory.

// Create an interaction record
var now_GR = new GlideRecord('interaction');
now_GR.insert();

var util = new sn_skill_rule.SkillDeterminationUtils();

var result = util.determineWorkItemSkills(now_GR);
gs.info(JSON.stringify(result));

Output:

[{"skillSysId":"6c0f025c7f672300a8b1bdc8adfa917f",
"skillName":"Premier Support Certified",
"mandatory":false,"skillLevelName":"",
"skillLevelSysId":null}]