
Hadyn
Tera Expert
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-05-2018 06:19 PM
I wanted an unimpersonate button in my service portal user dropdown menu so I can easily unimpersonate when I finished impersonating someone who only had access to the portal and not UI16.
You will need to clone the Stock Header widget sp_header_footer.do?sys_id=bf5ec2f2cb10120000f8d856634c9c0c
Update Body HTML template
<ul class="dropdown-menu" role="menu" aria-label="{{::data.profileBtnMsg}}">
<li role="presentation"><a tabindex="-1" ng-href="?id=user_profile&sys_id={{::user.sys_id}}" role="menuitem">${Profile}</a></li>
<li ng-if="data.isImpersonating" role="presentation"><a href tabindex="-1" ng-click="unimpersonate()" role="menuitem">${Unimpersonate}</a></li>
<li ng-if="::!isViewNative" role="presentation"><a tabindex="-1" href="{{::portal.logoutUrl}}" role="menuitem">${Logout}</a></li>
</ul>
Update Server Script and add this at the top line
data.isImpersonating = new GlideImpersonate().isImpersonating() || false;
if(input && input.unimpersonate == true){
gs.getSession().onlineUnimpersonate();
}
Update Client Controller
$scope.unimpersonate = function() {
$scope.server.get({unimpersonate:true}).then(function(response){
top.location = "/";
});
};
Labels:
- 728 Views
Comments
will_leingang
ServiceNow Employee
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
06-12-2019
08:24 AM
Great idea, Hadyn!