"Export to PDF" in Reports should only be visible to user with admin role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 02:52 AM
Highlighted option in reports should be only visible for user with admin role. How to achieve this?
Thanks in Advance,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 03:30 AM
Hi Sachin,
Try to follow the below step and complete your requirement.
To restrict the "Export to PDF" functionality in reports to users with an admin role in ServiceNow, you can customize the report widget by adding a client script. Here's an example of how you can achieve this:
- Go to the ServiceNow UI and navigate to the report you want to modify.
- Click on the gear icon in the top-right corner of the report and select "Configure" to enter the report configuration mode.
- In the report configuration, click on the "Formatters" tab.
- Scroll down to the "PDF" formatter section and note the formatter name (e.g., sys_report.PDF).
- Close the report configuration.
Next, you can create a client script to control the visibility of the "Export to PDF" option based on the user's role. Here's an example of the client script:
- Navigate to "System Definition" > "Client Scripts" in the ServiceNow UI.
- Create a new client script record with the following details:
- Name: Choose a unique name for the client script.
- Table: Choose sp_report for table.
- UI Type: Choose All to make the client script available on all UI pages.
- Type: Choose OnLoad.
- Script: Use the following script:
Save the client script record. The script will execute on page load and hide the "Export to PDF" button if the current user doesn't have the admin role.
Make sure to test the behavior of the report with a user who has the admin role and with a user who doesn't have the admin role to ensure the "Export to PDF" option is displayed or hidden accordingly.
Please note that the exact steps and script may vary depending on your specific version of ServiceNow. Adjustments may be necessary based on your ServiceNow instance's configuration and requirements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 03:39 AM
Hi Rahul,
- Click on the gear icon in the top-right corner of the report and select "Configure" to enter the report configuration mode.
I opened the report but there is no gear icon here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 06:22 AM
Hi Sachine,
I am trying to figure out if I got any other solution let you know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:27 AM
Hi Sachine,
Try below solution