- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
37m ago
How to enforce Demands, Projects, and Program to open in Workspace
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.
Before you begin
- Decide which role should be redirected. This article uses
it_demand_userfor Demands,it_project_userfor Projects andit_program_managerfor 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
adminrole. Admins may still need the classic form for configuration and debugging.
Key considerations
- The
answervariable 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';
}
}