Hide "Create Dashboard Button" in Platform Analytics for specific Roles

l-allenstein
Tera Expert

 

I need help to hide the “Create new dashboard” button in the Platform Analytics, Dashboard Library - depending on certain roles. The button is currently visible to everyone, but I would like only selected roles to be able to create dashboards.

lallenstein_0-1746629208493.png

 

1 ACCEPTED SOLUTION

l-allenstein
Tera Expert

Solution:

The create button is within 2 pages, Dashboard library and dashboard page:

lallenstein_3-1757515653693.png

 

It is possible to hide the create button via the UI Builder:

Dashboard Library:

1. Go to UI Builder, select Platform Analytics Experience

2. Create a duplicate of the Dashboard Library Variant

3. In the created duplicate, Select "Dashboard overview 1" component within the content panel on the left side

4. Within the configure panel on the right side, there is a "Hide create button" option. Click here on the "bind data" option

lallenstein_1-1757515368994.png

5. Select "Use script" on the top left, use following script to allow the functionality for specific roles:

lallenstein_2-1757515423562.png

 

 

/**
* @Param {params} params
* @Param {api} params.api
* @Param {TransformApiHelpers} params.helpers
*/
function evaluateProperty({api, helpers}) {
// get roles of logged in user
let user_roles = api.context.session.user.roles;
// only visible for users with role admin or reporting_admin
return !(user_roles.includes("admin") || user_roles.includes("reporting_admin"));
}

 

 

Attention: The "hide create button" functionality will also disable the filter function and the search function on the dashboard library page. After creating a support case for this behaviour, this works as per product requirements. A workaround solution for this is to create a customized dashboard library page.

 

 

Dashboard page:

1. Create a duplicate of "Dashboards" Variant in UI Builder in Platform Analytics experience

2. Select "Dashboard 1"  component in Content panel in the left side.

3. There is a configuration option "Disable dashboard creation", use "bind data" option.

lallenstein_4-1757515743301.png

4. Use the same script as in the first approach.

 

Important: To make the duplicated pages the standard page when visiting dashboard library or dashboard page, you need to configure the order for the respective variant via Settings of the variant:

 

lallenstein_6-1757516009815.png 

 

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@l-allenstein 

check this

Want to hide 'New Dashboard' option for pa_viewer role 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

this does not work unfortunately, i already commented your comment

The article is for pa_dashbaords and not for Platform Analytics

l-allenstein
Tera Expert

Solution:

The create button is within 2 pages, Dashboard library and dashboard page:

lallenstein_3-1757515653693.png

 

It is possible to hide the create button via the UI Builder:

Dashboard Library:

1. Go to UI Builder, select Platform Analytics Experience

2. Create a duplicate of the Dashboard Library Variant

3. In the created duplicate, Select "Dashboard overview 1" component within the content panel on the left side

4. Within the configure panel on the right side, there is a "Hide create button" option. Click here on the "bind data" option

lallenstein_1-1757515368994.png

5. Select "Use script" on the top left, use following script to allow the functionality for specific roles:

lallenstein_2-1757515423562.png

 

 

/**
* @Param {params} params
* @Param {api} params.api
* @Param {TransformApiHelpers} params.helpers
*/
function evaluateProperty({api, helpers}) {
// get roles of logged in user
let user_roles = api.context.session.user.roles;
// only visible for users with role admin or reporting_admin
return !(user_roles.includes("admin") || user_roles.includes("reporting_admin"));
}

 

 

Attention: The "hide create button" functionality will also disable the filter function and the search function on the dashboard library page. After creating a support case for this behaviour, this works as per product requirements. A workaround solution for this is to create a customized dashboard library page.

 

 

Dashboard page:

1. Create a duplicate of "Dashboards" Variant in UI Builder in Platform Analytics experience

2. Select "Dashboard 1"  component in Content panel in the left side.

3. There is a configuration option "Disable dashboard creation", use "bind data" option.

lallenstein_4-1757515743301.png

4. Use the same script as in the first approach.

 

Important: To make the duplicated pages the standard page when visiting dashboard library or dashboard page, you need to configure the order for the respective variant via Settings of the variant:

 

lallenstein_6-1757516009815.png