How to filter Opened For and Subject For in HR Agent Workspace Case Creation

pjftenorio
Tera Guru

In HR Agent Workspace, there is no filter or condition for Opened For and Subject For fields, how can we add a condition here that it should only display users with HR Profile.

pjftenorio_0-1761739410098.png

 

1 ACCEPTED SOLUTION

pjftenorio
Tera Guru

Sharing the solution we've done. 

We've replaced and did an override script include in the dictionary entry of Opened For and Subject For fields

 

Previous reference qualifier:

javascript:new sn_hr_core.hr_Utils().getSubjectPersonUsers()

 

New reference qualifier:

javascript:new sn_hr_core.nm_hr_Utils().getSubjectPersonUsers()

pjftenorio_0-1761898463427.png

 

New script include that will override OOB hr_utils

var nm_hr_Utils = Class.create();
// Override below functions from OOB Script Include: hr_Utils
nm_hr_Utils.prototype = Object.extendsObject(hr_Utils, {
	initialize: function() {
        // Call the parent constructor
        hr_Utils.prototype.initialize.call(this);
    },

	/**
     * Override getHRClientUsers to filter users
     */
    getHRClientUsers: function() {
        return "active=true^u_employment_type=Employee^ORu_employment_type=Regular Employee";
    },

    
type: 'nm_hr_Utils'
});

 

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@pjftenorio 

there is no direct way for this.

If you are talking about HR Agent workspace built on Configurable Workspace then you need to identify the Case Creation page and make changes to the variant by duplicating it.

not so easy thing to do.

this is the "Case Creation Page 2.0" variant which renders the modal, you can search there how the Subject Person and Opened For fields bring the value

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@pjftenorio 

see this script include "hr_CaseCreateSearchWsSNC" is bringing the filtered records for Subject Person and Opened For

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

pjftenorio
Tera Guru

Sharing the solution we've done. 

We've replaced and did an override script include in the dictionary entry of Opened For and Subject For fields

 

Previous reference qualifier:

javascript:new sn_hr_core.hr_Utils().getSubjectPersonUsers()

 

New reference qualifier:

javascript:new sn_hr_core.nm_hr_Utils().getSubjectPersonUsers()

pjftenorio_0-1761898463427.png

 

New script include that will override OOB hr_utils

var nm_hr_Utils = Class.create();
// Override below functions from OOB Script Include: hr_Utils
nm_hr_Utils.prototype = Object.extendsObject(hr_Utils, {
	initialize: function() {
        // Call the parent constructor
        hr_Utils.prototype.initialize.call(this);
    },

	/**
     * Override getHRClientUsers to filter users
     */
    getHRClientUsers: function() {
        return "active=true^u_employment_type=Employee^ORu_employment_type=Regular Employee";
    },

    
type: 'nm_hr_Utils'
});