- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
04-24-2025 11:51 AM - edited 08-01-2025 10:34 AM
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?:
Being able to provide consistent Resource Assignments within Project Templates allows organizations to efficiently provide starting points for Projects that require the same role, group, or skill at certain points of a project plan or for specific types of projects.
This guide will walk you through configuring the platform to allow adding Resource Assignments to your Project Templates.
- Configure Project Template elements for Resource Assignments (included in update set)
This allows for Project Templates to capture Resource Assignments when saving as a Template- Go to Project Administration > Settings > Template Config
- Add two (2) new configurations
- For Project
- Table: Resource assignment [sn_plng_att_core_resource_assignment]
- Parent Table: Project [pm_project]
- Link element: Task
- Active = true
- Elements: assignment_type, distribution, effort_type, effort, group_resource, role, skill
It is strongly recommended to minimize any additional elements, as we need to ensure creation of the Resource Assignments populate and work appropriately. - The name column (element) could be added if that is applicable and appropriate for your organization.
- Test any additional elements THOROUGHLY!
- For Project task
- Table: Resource assignment [sn_plng_att_core_resource_assignment]
- Parent Table: Project Task [pm_project_task]
- Link element: Task
- Active = true
- Elements: assignment_type, distribution, effort_type, effort, group_resource, role, skill
It is strongly recommended to minimize any additional elements, as we need to ensure creation of the Resource Assignments populate and work appropriately. - The name column (element) could be added if that is applicable and appropriate for your organization.
- Test any additional elements THOROUGHLY!
- For Project
- Create an Extension Point Script Include (included in update set)
This allows for the business rules to fire for updating the Resource Assignments once applied via the Template- Navigate to System Extension Points > Scripted Extension Points
- Open ‘global.ProjectTemplate’
- Once on the record, click ‘Create implementation’ Related Link
- Name: ProjectTemplateResourceAssignments
- Description: Implements extension point global.ProjectTemplateResourceAssginment for running applicable rules on creation of Resource Assignments within Project Templates when applied to a Project.
- Insert in the script, within the function, the following code:
//Get associated planning item var project = new GlideRecord('sn_align_core_project'); project.addQuery('execution_entity_item', projectId); project.query(); if (project.next()) var planningItemId = project.getValue('sys_id'); //Get associated resource assignments var g = new GlideRecord('sn_plng_att_core_resource_assignment'), objAr = []; g.addEncodedQuery('sys_idIN' + JSON.parse(listOfTaskIds)); g.query(); //construct object with previous effort + update effort to 0 while (g.next()) { objAr.push({ 'id': g.getUniqueValue(), 'effort': g.getValue('effort') }); g.effort = 0; g.update(); } this.updatePlanningItemFieldOnResourcePlanEntities(projectId, planningItemId); //loop through previously constructed array of object(s) and update with actual effort if (objAr.length > 1) { for (var i in objAr) { g.initialize(); if (g.get(objAr[i].id)) { g.effort = objAr[i].effort; g.update(); } } } }, //bulk updating planning items on Resource Assignments updatePlanningItemFieldOnResourcePlanEntities: function(task, planningItem) { this._updatePlanningItemFieldforTopTask('sn_plng_att_core_resource_assignment', task, planningItem); this._updatePlanningItemFieldforTopTask('resource_plan', task, planningItem, 'resource_type=attribute'); this._updatePlanningItemFieldforTask('resource_allocation', task, planningItem, 'resource_plan.resource_type=attribute'); this._updatePlanningItemFieldforTask('sn_plng_att_core_cpaam_effort', task, planningItem); }, _updatePlanningItemFieldforTask: function(table, task, planningItem, encodedQuery) { var gr = new GlideRecord(table); gr.addQuery('task', task); if (!gs.nil(encodedQuery)) gr.addEncodedQuery(encodedQuery); gr.setValue('planning_item', planningItem); gr.setWorkflow(false); gr.updateMultiple(); }, _updatePlanningItemFieldforTopTask: function(table, task, planningItem, encodedQuery) { var gr = new GlideRecord(table); gr.addQuery('top_task', task); if (!gs.nil(encodedQuery)) gr.addEncodedQuery(encodedQuery); gr.setValue('planning_item', planningItem); gr.setWorkflow(false); gr.updateMultiple();
- Save Script Include
- Navigate back to the Extension Point and find the newly created implementation on the Related List.
This allows for all other Template related Script Includes to run BEFORE the newly added one.- Add the ‘Order’ column to the list
- Update the new ‘ProjectTemplateResourceAssignments’ order to “1000”.
- Navigate to System Extension Points > Scripted Extension Points
- Create a Project Template that includes Resource Assignments
- Create a new Project in Project Workspace (or use an existing one)
- OPTIONAL: Apply an existing Project Template
- OPTIONAL: Create new tasks if not applying an existing Project Template
- Create ‘Unassigned’ Resource Assignments on the Project Summary Task OR on the applicable Project Tasks
- Make sure you fill in the Effort type, Effort, and applicable attribute(s) – Group, Role, and/or Skill for each Resource Assignment.
- Save the newly created Plan w/ Resource Assignments to a new Project Template
- Apply the newly created Project Template to a Project
- Follow your approved process for applying templates to projects.
- Follow your approved process for applying templates to projects.
- Configure additional setting - Expose Resource Assignments on Project Tasks
- To see Resource Assignments on Project Tasks, the Related List must be added.
- While on Project Task record (in native UI form), Configure > Related Lists
- Add the Resource Assignment -> Task to Selected and Save
-
This will be on the Form as well as appear within Project Workspace now
- To see Resource Assignments on Project Tasks, the Related List must be added.
- 1,096 Views