Join us Dec. 16 for The Community Hour, our first global virtual User Group event!
Luis Ataide
ServiceNow Employee

spm_header_option_demand_project_program.png

How to enforce Demands, Projects, and Program to open in Workspace

 

DISCLAIMER: This article describes how to use a Navigation Handler script to redirect users with specific roles from the classic form to the Workspace for Demands, Projects and Programs.
Test the scripts in a non-production instance before you deploy them. Adjust the role and admin conditions to suit your organization.

What problem does this solve?

Users who work in SPM can open Demand, Project and Program records in the classic form. If you want those users to land in the Workspace experience instead, you can use a Navigation Handler to redirect them based on their role.

This article shows how to create a Navigation Handler for Demands, Projects and Programs.

Reinforce_open_demands_projects_and_programs_in_Workspace.gif 


Before you begin

  • Decide which role should be redirected. This article uses it_demand_user for Demands, it_project_user for Projects and it_program_manager for Programs.
  • Users who do not have the role still see the classic form. Confirm the role is assigned to everyone who should be redirected.
  • The scripts exclude users with the admin role. Admins may still need the classic form for configuration and debugging.

Key considerations

  • The answer variable defaults to the original URI. Users who do not match the condition keep the classic form.
  • Adjust the role and admin conditions to suit your organization.
  • Demand and Program open in Strategic Planning Workspace or Portfolio Planning Workspace based on your SPM license and plugin installed. Confirm the version installed in the instance contains the Demand and Program modules before progressing.
  • Project opens in Project Workspace. Confirm Project Workspace is installed in the instance before progressing.

Step 1: Create the Demand Navigation Handler

Create a record in the Navigation Handler [sys_navigator] table with the following script. It redirects users with the it_demand_user role to the Demand record in the Strategic Planning Workspace (or Portfolio Planning Workspace).

answer = g_uri.toString();

if (!gs.hasRole('admin') && gs.hasRole('it_demand_user')) {

    answer =
'/now/alignment-workspace/demands/list/all/sub/record/dmn_demand/' +
g_uri.get('sys_id') + '/params/refresh-requested/' + new
GlideDateTime().getNumericValue();

}

Step 2: Create the Project Navigation Handler

Create a second record in the Navigation Handler [sys_navigator] table with the following script. It redirects users with the it_project_user role to the Project record in the Project Workspace.

answer = g_uri.toString();

if (!gs.hasRole('admin') && gs.hasRole('it_project_user')) {

    answer = '/now/workspace/project/home/sub/planning/pm_project/' +
g_uri.get('sys_id') + '/' + new GlideDateTime().getNumericValue();

}

 

Step 3: Create the Program Navigation Handler

Create a record in the Navigation Handler [sys_navigator] table with the following script. It redirects users with the it_program_,amager role to the Program record in the Strategic Planning Workspace (or Portfolio Planning Workspace).

The script in this case has to find the Portfolio Plan for the respective Program.

answer = g_uri.toString();
if (!gs.hasRole('admin') && gs.hasRole('it_program_manager')) {

	//Get Portfolio Plan for the Program
	var grPortfPlan = new GlideRecord ('sn_align_ws_portfolio_plan');
	grPortfPlan.addQuery('lens_entities', g_uri.get('sys_id'));
	grPortfPlan.addQuery('lens', 'e18259824333311099c29baf7cb8f2a6'); //Lens Project Program
	grPortfPlan.setLimit(1);
	grPortfPlan.query();

	//If Portfolio Plan for the Program exists, redirect user to Portfolio Plan in Workspace
	if (grPortfPlan.next()) {
		answer = '/now/alignment-workspace/programs/sub/portfolio/' + grPortfPlan.getValue('sys_id') + '/' + new GlideDateTime().getNumericValue() +'/params/work-flow/program_details';
	}  
}

 

 

Version history
Last update:
56m ago
Updated by: