Every developed application or platform faces the inevitable need for testing requirements. There are many types of users with different accesses and permissions to different processes in ServiceNow. There is an impersonation feature in ServiceNow that will help you analyze whether the user is able to access a desired set of data or not. As this feature is not available OOB in Service Portals, administrators are required to add it manually.
Impersonation and Service Portals
Impersonation in ServiceNow is a powerful feature that enables administrators and users with the appropriate permissions to temporarily assume another user’s identity within the system. This functionality is essential for troubleshooting, testing, and providing support, as it enables administrators to view and interact with the platform exactly as the impersonated user would.
Impersonation allows admins to troubleshoot and verify what a user can and see in their context menu based on the permissions they have been assigned or the role applied to them without having to log out and back in as different users. This facilitates administrator’s management of user experiences and ensures security by logging impersonation actions in the system logs.
What are Service Portals?
Service Portals in ServiceNow are web-based interfaces. They are designed to provide a practical and easy way for users to interact with the platform’s various services and applications. These portals are highly customizable, and allow organizations to tailor their look, feel, and functionality to meet their needs and branding requirements.
This article will explore adding impersonation functionality to the Customer Support Portal. Firstly, let us see how we can add the Impersonation button to a Portal in ServiceNow.
Adding Impersonation Button to CSM
The Impersonation button can be added by creating or editing a widget. In this case, the Impersonation user widget was already added and is being used in the Employee Center portal. First, let’s see how to add Impersonation in the Employee Center, followed by adding it in CSM.
Below are the screenshots for the Employee Center portal and how another user can be impersonated.
By clicking on “Impersonate User,” a model will appear that allows searching for and finding the user who needs to be impersonated.
You can also end impersonation by clicking on the “End Impersonation” button once you end your testing. Below are the screenshot demos of how this was implemented. After some research, it was found that in the Employee Center, there is a header named “Employee Center Header,” which is a widget in which all the functionalities are implemented.
This widget is composed of HTML, CSS, Server Script, Client Logic, and a link function. What was needed was found in the server script in a line where another widget was called.
In line 19, using Angular, shows how to render a widget whose value is equal to data.avatarDropDown.
Line 149 in the screenshot above shows the widget profile-with-dropdown and how to pass some parameters to it. This widget is what was seen in the Employee Center screenshots, where the profile icon was clicked, and a dropdown appeared. So, what is implemented in this widget? In HTML, there are some buttons with conditions to make them visible on the screen or hide them from it. But right now, the focus is only on the “Impersonate” and “End Impersonation” buttons.
These buttons are bound to these functions. When the conditions for making these buttons are true, these buttons will appear on the model, and by clicking them, the functions below will be executed.
This functionality was for the Employee Center, and from this, one could get an idea of how to add this to CSM. The widget was not added to the CSM Header as there was already some functionality implemented there. Just an Impersonation button was added and bound to the right function. The screenshots below will explain it in detail.
The Impersonate button is what was added to the code in HTML. And on the server-side, just this function. It worked fine.
Here is a demo of impersonation in CSM as well. It is not much different, but it shows that you must add these functionalities yourself in Service Portals.
Mobiz CSM also has impersonation functionality.
You don’t face many issues to complete this as a developer as all the functionalities are there in the case. However, one thing that is new is the Application Restricted Caller Access. It came to prominence because, while testing the header widget, when preview was enabled, it caused some issues. Because of the problem, the header widget could not load in the Employee Center portal.
After some research on the developer community, this error appeared which was about restricted access to cross-applications. In that article, the given solution suggested going to the Application Restricted Caller Access module and finding the right record that was causing the error. Here is a screenshot showing the error that appeared.
So, after following the instructions, the error record was finally found, which initially looked like this.
When the status was changed to “Allowed,” the header widget was already in the Employee Center.
Final Word
This was all about adding the Impersonation button to the header widget in CSM and the Employee Center. There are several customizations available by Mobiz. The good thing about these customizations is they are not OOB from ServiceNow which will help you if you are also an organization like us. Get in touch to know more.
Empower Your Business with Our Innovative IT Solutions!
- Cloud Services
- ServiceNow Integrations
- AI Implementation on Azure OpenAI
Join the newsletter!
Data insights and technology news delivered to you.
By signing up for our newsletter you agre to the Terms and Conditons