HR Agent Workspace - Add Direct Reports and its popover to At a glance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 01:04 AM
In the old HR workspace, the Org Information was part of its OOB configuration, but in the new HR Agent Workspace it's a component that you had to create yourself. Detailed below are the steps on how this can be accomplished.
1. Update the hr_atAGlanceUIBUtils script includes
var hr_atAGlanceUIBUtils = Class.create();
hr_atAGlanceUIBUtils.prototype = Object.extendsObject(hr_atAGlanceUIBUtilsSNC, {
initialize: function() {
hr_atAGlanceUIBUtilsSNC.prototype.initialize.apply(this, arguments);
},
/**
* Get the direct reports of a user.
*
* @Param {String} userSysId - The sys_id of the user.
* @return {Array} An array of direct reports.
*/
getDirectReports: function(userSysId) {
var directReports = [];
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('user.manager.sys_id', userSysId);
gr.addQuery('user.active', true);
gr.orderBy('user');
gr.query();
while (gr.next()) {
var report = {
value: gr.getValue('sys_id'),
displayValue: gr.getDisplayValue('user'),
email: gr.getValue('user.email'),
department: gr.getDisplayValue('user.department'),
position: gr.getDisplayValue('position'),
labelvaluestacked: []
};
var labelvaluestacked = [];
// Position
var positionLabel = gr.getElement('position').getLabel();
var positionValue = gr.getDisplayValue('position');
var positionDetails = {
label: positionLabel,
value: {
type: "string",
value: positionValue
}
};
labelvaluestacked.push(positionDetails);
// Department
var departmentLabel = gr.getElement('user.department').getLabel();
var departmentValue = gr.getDisplayValue('user.department');
var departmentDetails = {
label: departmentLabel,
value: {
type: "string",
value: departmentValue
}
};
labelvaluestacked.push(departmentDetails);
// Email
var emailLabel = gr.getElement('user.email').getLabel();
var emailValue = gr.getDisplayValue('user.email');
var emailDetails = {
label: emailLabel,
value: {
type: "text-link",
href: "javascript:void(0)",
underlined: true,
label: emailValue,
link: "javascript:void(0)"
}
};
labelvaluestacked.push(emailDetails);
report.labelvaluestacked = labelvaluestacked;
directReports.push(report);
}
// gs.info("Direct Reports: " + JSON.stringify(directReports));
return directReports;
},
getAtAGlanceDetails: function(table, sysId, casesLimit, userSysId) {
var recordGr = this._getRecordGr(table, sysId);
// Get the value of opened_for (HR Case)or user (HR Profile) field as userSysId
var userSysId = recordGr.getValue('opened_for') ? recordGr.getValue('opened_for') : recordGr.getValue('user');
var data = hr_atAGlanceUIBUtilsSNC.prototype.getAtAGlanceDetails.call(this, table, sysId, casesLimit, userSysId);
var userGr = this._getUserGr(userSysId);
if (userGr && userGr.isValidRecord()) {
data.directReports = this.getDirectReports(userGr.getUniqueValue());
} else {
data.directReports = [];
}
return data;
},
type: 'hr_atAGlanceUIBUtils'
});
2. Duplicate the Case SRP and set its order to an integer lower to set it as the default.
3. On the cloned Case SRP, head on to the "At a glance container" and create the Direct Reports container and its components under the Team Card container
4. Create the client state parameters:
6. Duplicate the Manager popover, and update the following component values:
|
Disable the HR SRP#AAG OPEN MANAGER PROFILE - Data resource Events and create a "Link to destination" event handler.
|
6. Go back to the Direct Reports container > Text Link 2 and create the following Events and map the values to the @item:
|
|
|
Select the popover from 6. |
Final Result:
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 07:35 PM
This was an excellent tutorial and it worked perfectly; thank you!