Widget not showing up under certain circumstances (HRSD Cases)

tahnalos
Kilo Sage

I'm trying to understand how the HRM Case Info widget determines what info is displayed to certain users.

Specifically, when a person tries to view a HR Case ticket (that they request for themselves) through the "My Requests" page they usually get this:

2026-03-18_15-41-14.PNG

 

We have modified our HR intake process so that Managers can request HR services on behalf of their direct reports.  So if we set it up so that the Manager requests on behalf of the employee, the following is seen:

2026-03-18_16-13-44.PNG

Note how the info below the Title of the request is shown when the user is requesting for themselves but not when they request for someone else.  How is the HRM Case Info widget set up to display these fields and is there a requirement that the person submitting needs to be the same as the person's name on the ticket?

We don't think there is an issue with the access control for the tickets in question for two reasons: 1) when we attempted to reproduce this with someone with Admin access, they have the same issue as the second screenshot and 2) we attempted to check the access control for the widget itself and both the person who is submitting the tickets and the person who is requesting the ticket for is have the same roles.

Some insight would be useful as to how this specific widget works.

4 REPLIES 4

An Le
Giga Sage

Hi @tahnalos ,

 

The widget name is HRM Case Info.

The main condition controlling whether the richer information is shown is:

     if (data.openForView || data.isApprovalRequired)
 

The values used in that condition come from:

     data.openForView = util.isOpenedForView();
    data.isApprovalRequired = util.isApprovalRequired(data.parentCaseId, gs.getUserID());
 

That means the widget is not simply showing fields to anyone who has access to the ticket. It is specifically showing them when the current user qualifies as part of the opened-for view or as an approver.

So in your manager-on-behalf-of scenario, the likely reason the info below the title is missing is that the manager is the submitter/opened_by, but does not satisfy isOpenedForView() for that case. As a result, the widget skips the block that populates those fields.

 

Kind regards,

An Le

Thank you for your help.

What is the data object?  I am unclear as to how widgets work.  Is openForView a defined attribute?

Thanks for your help.  It looks like I need to modify _getCaseConfiguration to include the criteria for opened_by, as the criteria strictly looks at opened_for.

 

I could modfiy the hr_PortalUtil, but that is marked as a core file so according to ServiceNow best practices, it's best to create a extension of the hr_PortalUtil and have the widget look at that.  And that part is a whole new can of worms that I have already asked elsewhere in the community.

 

Thanks for your help.

Ok so I attempted to modify the code itself with a custom function.  The following lines were added to the Widget and the code is still working but the Opened By person still cannot see the data:

 

The following line was modified:

data.openForView = util.isOpenedForView () || isOpenedByView (grCase);
 
The following lines were added to the widget:
    function isOpenedByView (gr)
    {  
        if (gs.nil(gr))
        {
            return false;
        }
        var opened_by = String (gr.opened_by);
        return opened_by == gs.getUserID ();
    }
 
I've ran tests on these lines and they appear to be working but the widget still doesn't show.  Is there something that I'm missing regarding how the widget is supposed to work?