So I am trying to populate User name and email onto a URL.

I have a button on a custom object which will re-direct me to a Visualforce page with few fields where on hitting save will fill a URL(google form).

So I want to pre-fill username and email without having them enter it and have the values onto the URL

I tried using merge fields {!User.Email} on the URL but it did not work.

  • Pls share current code, so that we can suggest modifications.
    – Victor
    May 29, 2015 at 21:02
  • Victor for the current code I don't have anything that relates to what I am asking but here's my URL below for better understanding. docs.google.com/a/mycompany.com/forms/d/…'{!User.Email}'&entry.315413522='+desc+'&entry.1366373962='+info+'&entry.1716955237='+steps+'&entry.1435223618='+severity+'&submit=Submit
    – Sanjay
    May 29, 2015 at 21:15
  • 1
    Sounds like you need to use urlencode: {!URLENCODE(User.Email)} May 29, 2015 at 22:02
  • Hi Mark, so I tried that and I am receiving "Error: Unknown property 'Escalations__cStandardController.User' " Escalations__c - is the name of the custom object. Does this mean I need the query the UserID and Email in the apex ? if so can you help me with that ?
    – Sanjay
    May 29, 2015 at 22:08

1 Answer 1


Try {!$User.Email}. The $ is important if you're trying to grab the logged in user in a button.

URLENCODE is not a bad idea, but maybe not necessary.

  • I'm receiving this error Error: Unknown property 'Escalations__cStandardController.userId'
    – Sanjay
    Jun 1, 2015 at 0:33
  • 1
    Where are you getting this error? When trying to save the VF page? $User is a global variable as documented here. I'm not sure what might be wrong. Can you post the code?
    – RyanP
    Jun 1, 2015 at 5:59
  • Hey Ryan, my bad it did worked great it was a different part of the code that was causing this issue (javascript) Thanks so much for your answer !
    – Sanjay
    Jun 1, 2015 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .