1

I want to decide to show/hide a particular text when an Account detail page is loaded, based on the user logged in.

How can I achieve this i.e. making a decision when the account detail page is loaded. Till now I have created a visual force page to show the custom text when a button is clicked. But I want to make the decision when the account detail page loads as per the user logged in.

Thanks a lot.

  • You want to check the user in your controller? Or the profile of the logged in user? – highfive Aug 18 '14 at 7:53
  • are you using visualforce page jus for this requirement ? You can do this in a standard detail page itself right ? – Vamsi Krishna Aug 18 '14 at 8:02
1

This rather depends where the custom text is going to live.

If you can use a formula field to generate the text, you can conditionally display it based on the user's profile using the $Profile global.

If not, or if you need HTML type markup or similar, you can embed a Visualforce page into the standard record view page and generate the output based on the profile or other information about the logged in user. You can get at some user information in the Apex controller via the UserInfo class - this contains the id of the current user, so you can retrieve the user record using a SOQL query, e.g.

    User currUser=[select id, ManagerId from User where id=:UserInfo.getUserId()];
| improve this answer | |
  • I will try this and see if this matches my requirement. – ParoTech Aug 18 '14 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.