+ Start a Discussion
BManojKumarBManojKumar 

User Details in Opportunity Visual force page

Hi All,

 

I have a visual force page to override the opportunity new button. I have some business logics based on the user creating the opportunity. I am trying to pre-populate account name in the opportunity page based on the user's information. Is der a way to get the user information in the visual force page ?

 

If we create a new opportunity the opportunity owner name is pre-populated in the page. So , there must be a way to find the user information.

 

Thanks in Advance.

 

Manoj.

Best Answer chosen by Admin (Salesforce Developers) 
BManojKumarBManojKumar

Hi All,

 

I created a custom button whose url is a visualforce page. I am passing the user id with that url. I overridden the opportunities tab with a visual force page which has the custom button in it. So, whenever the user clicks the opportunities tab they will redirected to the visual force page. With the help of the custom button we can trace the user id.

 

Manoj. 

All Answers

BManojKumarBManojKumar

Hi All,

 

I created a custom button whose url is a visualforce page. I am passing the user id with that url. I overridden the opportunities tab with a visual force page which has the custom button in it. So, whenever the user clicks the opportunities tab they will redirected to the visual force page. With the help of the custom button we can trace the user id.

 

Manoj. 

This was selected as the best answer
sinsiterrulezsinsiterrulez

Hi,

You can use UserInfo.getUserId() in apex class to get the current logged in User's ID.

Passing User ID from URL can lead to SOQL Injection