Cannot duplicate or copy a dashboard as a general user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 03:13 PM
We have setup a default dashboard for users but they are not able to duplicate or copy it so they can customize it for themselves. ServiceNow Documentation shows that you have to either be the dashboard owner or an admin to be able to duplicate a dashboard. I was wondering if anyone came up with a solution where a user could be setup to duplicate a default dashboard?
- 1,110 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 06:38 AM
@WillyBThanks for the business rule. I'm curious, what are its trigger conditions on "when to run"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 08:48 AM
Here's a pic of that page. We only have a few variables on the catalog item which is what dashboard they want to copy, what they want to name the new dashboard and who should be the owner. We also make them accept a disclaimer that while everything will be copied there may be reports/widgets that a user may need to give them permissions to so that they can view it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 10:26 AM
@WillyBThanks for the details. I see the magic is done within this class & method:
SNC.ContentGeneratorUtil.duplicate(dashboardName)
This all seems to be an undocumented. And I could not find this in our script includes. However, I see that it works as I fed it a sys_id of a pa_dashboards record and sure enough it generated a fully copy. How did you become aware of this class & method and even know what it was supposed to take as input and the details about the JSON object it returns?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 12:04 PM
There is a built in duplicate feature but it requires a level of access (pa_admin I believe) that would be too much to give every user so we leveraged that built in feature through the catalog item bypassing that access requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 01:05 PM
Ah yes. I was aware of that feature but I had given up on leveraging that as an option because while I could access the Duplicate Dashboard feature from a dashboard's upper left menu, I didn't see it as a UI Action on the pa_dashboards table. So I was a bit lost on how to access its underlying code. I wasn't surprised though since the Dashboard UI isn't a record form so there was a bit of an unknown there on the relationship of that menu of actionable options and the fact they reside on a dashboard anyway. I also figured it could be one of those rare pieces of functional code that is not exposed to the customer in any way.
After reading your response here though, it had me reconsidering where the "Duplicate Dashboard" feature would be configured. I ended up using the global code search option in Studio to search for "duplicate dashboard". The results listed a Duplicate Dashboard UI Action on the Solution (pa_content_pack) table. Its script contained the similar code in your BR.
Very cool solution!