The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How do I restrict the Resource Assignment toggle in Project Workspace to only a specific role?

dpattersonryder
Tera Contributor

Hi Everyone,

I'm working in the ServiceNow Xanadu Build, customizing the Project Workspace (SPM) Experience.  Specifically, I need to restrict visibility of the Resource Assignment Toggle in the planning workspace.  

My Goal:
Only users with either the it_pps_admin or our new resource_user_pilot roles should see the Resource Assignment Toggle/Button in the Planning view.

What I've tried so Far:
Client Scripts that set state.showResourceToggle based on user roles and bind that to the toggle's "Hide component" property. 
DOM manipulation (e.g., using queryselector to hide the toggle after page load).
Modify classicConsoleURLsJSON output in an onDataChanged script to filter out the resource pane. 
UI Scripts with role checks, g_user.hasrole, etc.

Despite these, the toggle still renders or fails to bind properly in the UI Builder.

What I need to know:

Is there a supported way to control visibility of the Resource Assignment Toggle (or Pane) in the Project Workspace using role-based logic?
Can the Planning UX Page or its macroponent be overridden cleanly?
Has anyone successfully scoped visibility for that toggle using macroponent overrides, UI Builder conditionals, or a clean UXF pattern?

Appreciate any guidance or best practices! I want to do this the right way, not with a fragile DOM patch. 

Thanks, 
Devon Patterson

1 ACCEPTED SOLUTION

Nootan Bhat
Kilo Sage

Hi @dpattersonryder ,

In the script include "ProjectWorkspaceConfig" there is a function getConfig, which return the Config properties for PW. 
you can modify the property value isRPEnabled: ProjectWorkspaceUtil.isResourcePlanningEnabled() to 

isRPEnabled: ProjectWorkspaceUtil.isResourcePlanningEnabled() && (gs.hasRole("ROLE_NAME")),

This way you can control the access without modifying the UI builder elements.

 

If this helps, please mark my answer as Accepted solution.

 

Hope it helps!

Nootan 

 

View solution in original post

6 REPLIES 6

Alpa82
Tera Expert

Hello @Nootan Bhat can we also restrict for which projects (from which table, we use the teamspaces) the resource assignment toogle is enabled? e.g. we would like to keep it enabled only for one teamspace and for another not.

Thank you

Yes. Same script include & same function checks the project record. So you can get the sys_class_name and control the behavior. Just like role check, you can try for table, record, may be some field value at top task as well.