Josh Sutton
ServiceNow Employee
ServiceNow Employee

DISCLAIMER: This article describes a proposed solution to support this use case. 

The proposed solution requires configuration, as such, there is no liability for ServiceNow to provide support, apply changes, fix defects and review impact during future upgrades.

 

What problem does this solve?

In addition to adding and using custom planning attributes for Resource Assignments and Capacity Planning, the ability to sort the Resource cards within Resource Management Workspace is essential to viewing a lot of data in a consumable way.

Furthermore, this allows for the roll up of Availability information that users are accustomed to viewing within the RMW Heatmap panel.

 

2 of the Script Includes being modified within this walkthrough are designed for these very situations of customization. ServiceNow uses a combination of “SNC” suffixed SI’s, along with a corresponding “non-SNC” SI. You can override the functions of the non-SNC Script Includes that extend the SNC scripts.

 

Prerequisites

  • Setup of a custom planning attribute(s) must be completed to implement this solution and can be found HERE.
  • Additional columns may be added for certain scenarios, you can view the solution HERE.

 

 

Configuring Script Includes with custom planning attribute

  1. In this example, we are using a custom planning attribute called ‘Location’ that is on the sys_user record “user.location”.
    Planning Attribute.jpg

  2. Configure RMWorkspaceService
    • Ensure scope is ‘Resource Management Workspace’
    • Navigate to System Definition > Script Includes
    • Search ‘Name starts with RMWorkspace’
      • Find the following two scripts
        • RMWorkspaceService and RMWorkspaceServiceSNC
    • We are going to override the _getGroupByConfig() array in the SNC versions by adding our own to the non-SNC script.
    • Open RMWorkspaceServiceSNC script and locate the _getGroupByConfig() and copy the entire code (copy to text editor if you like)
    • Open RMWorkspaceService
      *Note: the RMWorkspaceServiceSNC (this is the read-only Script Include and should NOT be edited)
      Script_Includes 1.jpg
    • Add in the _getGroupByConfig() just copied, and we will modify it to include the custom attribute.

      *Note: be sure to paste the code just above the “type: ‘RMWorkspaceService’” in the existing script.

      undefined.png

    • The following provides the ‘getGroupByConfig()’ array as copied from the RMWorkspaceServiceSNC script and highlighted the modification to append it.(use YOUR custom attribute)

      _getGroupByConfig() {

              return {

                  'fields': [{

                          'id': 'group_resource',

                          'label': gs.getMessage('Primary Group')

                      },

                      {

                          'id': 'role',

                          'label': gs.getMessage('Primary Role')

                      },

                      {

                          'id': 'skill',

                          'label': gs.getMessage('Primary Skill')

                      },

                      {

                          'id': 'owner',

                          'label': gs.getMessage('Owner')

                      },

                      {

                          'id': 'parent_item',

                          'label': gs.getMessage('Parent Item')

                      },

                      {

                          'id': 'location',

                          'label': gs.getMessage('Location')

                      },

                      {

                          'id': 'none',

                          'label': gs.getMessage('None')

                      }

                  ]

              };

          },

    • Update the Script Include and return to the filtered Script Include list
  3. Configure RMWorkspaceDataFetch
    • Ensure scope is ‘Resource Management Workspace’
    • Navigate to System Definition > Script Includes
    • Search ‘Name starts with RMWorkspace’
      • Find the following two scripts
        • RMWorkspaceDataFetch and RMWorkspaceDataFetchSNC
      • We are going to override the ‘createResourceRow(userList, filterType)’  function in the SNC versions by adding our own to the non-SNC script.
      • Open RMWorkspaceDataFetchSNC script and locate the ‘createResourceRow(userList, filterType)’  and copy the entire code (copy to text editor if you like)
    • Open RMWorkspaceDataFetch
      *Note: the RMWorkspaceDataFetchSNC (this is the read-only Script Include and should NOT be edited)
      Script_Includes 3.jpg
    • Add in the createResourceRow(userList, filterType) just copied, and we will modify it to include the custom attribute.

      *Note: be sure to paste the code just above the “type: ‘RMWorkspaceDataFetch’” in the existing script.

      Script_Includes 5.jpg

    • The following provides the ‘createResourceRow(userList, filterType)’ function as copied from the RMWorkspaceDataFetchSNC script and highlighted the modification to append it. (use YOUR custom attribute)

      createResourceRow(userList, filterType) {

              const empIds = [],

                  userRows = [];

              for (const user in userList) {

                  const id = userList[user].id;

                  var userGr = new GlideRecord('sys_user');

                  userGr.get(id);

                  var userlocation = {

                      "value": userGr.getValue('location'),

                      "displayValue": userGr.getDisplayValue('location')

                  };

                  resRowObj = {

                      id: id,

                      task: {

                          value: userList[user].id,

                          displayValue: userList[user].userName,

                          indicator: {

                              icon: "circle-check-outline",

                              "color": "--now-color_alert--positive-2",

                              "tooltip": gs.getMessage("Resource is properly allocated based on their schedule through this specific time period.")

                          },

                          group_resource: userList[user].primary_resource_group,

                          role: userList[user].primary_resource_role,

                          skill: userList[user].primary_resource_skill,

                          location: userlocation

                      },

                      _metadata: {

                          disableRowReorder: true,

                          disableRowContextMenu: true,

                          disableEditing: true,

                      }

                  };

                  userRows.push(resRowObj);

                  empIds.push(id);

                  this.resourceMap[id] = resRowObj;

              }

              return (filterType != 'task') ? empIds : userRows;

          },
    • Update the Script Include
  4. Configure RMWorkspaceGroupByUtils (UX Client Script Include – ‘sys_ux_client_script_include’)
    • Ensure scope is ‘Resource Management Workspace’
    • Navigate to sys_ux_client_script_include.list
    • Search ‘Name starts with RMWorkspace’
    • Open RMWorkspaceGroupByUtils
      *Note: there is NO RMWorkspaceGroupByUtilsSNC like the other Script Includes.
      UX_Client_Script_Includes 1.jpg

       

      UX_Client_Script_Includes 2.jpg

    • Unfortunately, a UX Client Script Include does not contain line #s or enhanced script capabilities…so the appropriate way to update this with the custom planning attribute would be to search in the script (<ctrl> f) for ‘const primaryAttributes’.
    • You will add the name of the custom attribute exactly as written in Step 2 as ‘id = <attribute>‘. For our use case, this is ‘location’, as seen in the above image.

Using custom attribute within Resource Management Workspace

  1. Confirming attribute is now available in the Group by list
    • Navigate to Resource Management Workspace and select a Resource card or create a new one
    • Within the resource card, drop down the Group by list and validate your custom attribute is now available
      Resource_board 1.jpg

  2. Visualize your Resources by the new attribute
    • Once selected, you can now see your Resources grouped together by this new attribute (regardless of the attribute being populated on the Resource Assignment – because of these configurations, it uses the data from the Employee Profile / User record where the attribute resides)
    • If there is any empty data, these users will be grouped by ‘Empty’ as seen in the image below
      Resource_board 2.jpg

    • Along with grouping our Resources by this new attribute for an easier and more consumable way, the heatmap will display the rollup data for this grouping as well, giving us another way to “slice & dice” our Resources on a given Resource card
      Resource_board 4.jpg

      Resource_board 3.jpg

  3. Custom Attribute on Resource Assignments
    Ensure that the Prerequisite #1 was followed completely (primarily the steps: Fields for creating column configurations & Creating column configuration)
    • From Resource Management Workspace or Project Workspace (Details), create a new Resource Assignment, the new attribute will be present. You can now use this attribute to filter Resources when assigning or requesting – whether singularly, or in conjunction with other attributes.
      Create_New_Resource_assignment 1.jpg
    • Furthermore, when a Resource is selected (and this attribute is not pre-populated) this configuration will now automatically populate the new attribute on the Resource Assignment just like it does for the OOB primary attributes (Group, Role, Skill).
      *NOTE: for any Resource Assignments created prior to a new attribute being configured, it will not automatically populate.
      Create_New_Resource_assignment 2.jpg
Comments
DanielCordick
Mega Patron
Mega Patron

Awesome, glad to see this fix proposed as a solution for the community!

Version history
Last update:
‎08-05-2025 02:02 PM
Updated by:
Contributors