My Request Filter in ESC shows approved HR cases even if the case is not opened by approver

bhaavani
Tera Contributor

Hi Experts,

 

When a HR case is submitted for approval by a HR agent in HR Agent Workspace. Approver logins in to employee center and the HR case is displayed both in "My Tasks" and "My Requests". Once he/she approves that HR case from "My Tasks" the HR case is getting disappeared as he/she approved it and this is working as expected. However it is still showing in "My Requests" which should not be the case as the logged in person is only the approver but not the "Opened for" or "Opened by" or "Subjected person". We raised a HI case and HI team said that this is the OOB feature. And asked to edit the "My Request Filter" that is configured for "HR Cases Open".  I tried adjusting the script include "sn_hr_core.hr_caseOpenRequestFilterUtil()" however it didnt worked. Can someone help me here ? I need to see the HR cases in "My Request" only if the logged person is the "Opened for" or "Opened by" or "Subjected person" of that HR case but not the approver of the case.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hi @bhaavani ,

 

Yes you are right. We also had similar issue. You can edit the OOB script include "hr_caseMyRequestFilterUtil". However please note that this is a high-risk record. And you may need to review this if you make any changes in your skipped logs when upgrade happened. Please be more cautious while updating this. Below is the logic I have added 

while (grApproval.next()) {
           var caseID = grApproval.getValue('sysapproval');
            var approvalState = grApproval.getValue('state');
            var approverID = grApproval.getValue('approver');
            var hrCase = new GlideRecord('sn_hr_core_case');
            if (hrCase.get(caseID)) {
                var requester = hrCase.getValue('opened_for');
                if (requester == this._user) {
                    ids.push(caseID);
                    continue;
                }
                if (approverID == this._user && ['approved', 'rejected', 'not_required'].indexOf(approvalState) > -1) {
                    continue;
                }
                ids.push(caseID);
            }
        }

View solution in original post

6 REPLIES 6

Wessel van Enk
Tera Guru
Tera Guru

Hi @bhaavani,

In the ToDo Filters of the Employee Center settings, there is an filter for approvals. 
In there, there is an associated condition for completed approvals:

WesselvanEnk_0-1764144250536.png



Did you try to de-activate this condition?

As OOB indeed the completed approvals are also shown under the tab 'Completed'. 

Hi @Wessel van Enk ,

 

To-do configuration is on "My Tasks" not on "My Requests". If you can see the below screenshot for "My Tasks" the solution you proposed will apply I believe: But if you see the 2nd screenshot "My Request" have submitted tickets why approval cases are showing. If they show its okay however the issue is even after approving them it's still showing there.

 

MC30_0-1764155065039.png

 

MC30_1-1764155187251.png

 

Thanks in advance

 

@MC30 Ah check! I believe then it's indeed the best to copy or modify the script include and remove the filters for approvers. You mentioned it didn't work, but which part of the script did you modify? 

If you put something like this in the script, it should work:

var MyHrCaseFilterUtil = Class.create();
MyHrCaseFilterUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getFilter: function() {
var userId = gs.getUserID();
var filter = "opened_for=" + userId + "^ORopened_by=" + userId + "^ORsubject_person=" + userId;
return filter;
}
});


bhaavani
Tera Contributor

Hi @MC30 ,

 

Thanks for your reply. This is what exactly we are facing the issue. I hope you also faced the similar issue and that's the reason you have understood my issue. Can you please help me to fix this issue ?

 

Thanks in advance,

Bhavani