Search This Blog

Friday, November 18, 2011

Custom "Login as Owner" button

As an admin of an org with ~100 records types and countless page layouts, I often have to login as a specific user to troubleshoot something he/she is not seeing. Most of these troubleshooting sessions would be with the record owner on the phone where he/she would give me an account number or a booking number and we'd go look at the record. Having to go to Setup | Manage Users | Users.... or search for the user then go to the user detail and click on Login was getting old. This lead me to create a custom button that I placed on the Admin page layout for objects such as Accounts and Opportunities. This is useful for me because our admins have a specific page layout for each object that contains a lot of audit fields that we do not want to include in the other layouts. Now when a user contacts us, we can simply navigate to the record in question and click on the "Login as Owner" button and viola! We are now logged in as the owner seeing the specific record being discussed in their assigned layout. No searching, not traversing the Setup menu.

Here's the code for the button. This code is for the Lead object. Customizing it for other objects is cake. Just set the targetURL to match the appropriate object Id. In the Lead example below, it's set to "{!Lead.Id}"

Click on Setup | Customize | Leads (adjust this accordingly) | Buttons and Links | New
Label: Login as Owner
Name: Autofilled (Login_as_Owner)
Display Type: Detail page Button
Behavior: Display in New Window
Content Source: URL

Link Code:
/servlet/servlet.su?oid={!Organization.Id}&suorgadminid={!Lead.OwnerId}&retURL=%2F005%3FretURL%3D%252Fui%252Fsetup%252FSetup%253Fsetupid%253DUsers%26setupid%3DManageUsers&targetURL=/{!Lead.Id}



No comments:

Post a Comment