…thoughts on ServiceNow and digital transformation

Post

ServiceNow View Rule on User Table for HRSD Fulfillers


In the form view for an HRSD case, clicking the preview button next to the Opened for or Subject person fields takes the user to the HR Profile form for the record. However, if you’re in the list view and click one of these fields, the user is taken to the User table. This is confusing for HRSD fulfillers as the view is usually the Default view and this view is meant for ITSM. There is a human_resources view, however the user has to manually change to this view. A view rule based on conditions in the record won’t solve this because the condition is based on the user viewing the record (i.e. user has the sn_hr_core.basic role). Furthermore, when an HRSD fulfiller views their own profile, they should get the ess view and not human_resources. Below is a view rule based on the user role and the view requested in the URL:

(function overrideView(view, is_list) { 

    // force the human_resources view for hr fulfillers but not admins or itil. 

    if ((gs.hasRole('sn_hr_core.basic') && !(gs.hasRole('admin')) && !(gs.hasRole('sn_hr_core.admin')) && !(gs.hasRole('itil'))) { 

        //if the view is ess, leave it as ess 

        if (view == 'ess') { 

            answer = 'ess' 

        } else { 

            answer = 'human_resources' 

        } 
 

    } 

})(view, is_list);