function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sam AlexSam Alex 

Fill custom object text field with currently logged in user name


I have a custom object. I have have user email field. When I go to the details of the custom objects record, I want to fill the "User Email" textbox with the email of currently logged in user. (only if the records "User Email" value is empty).

How can I do this?

Thanks in advance.
Robert RichterRobert Richter
Hi Sam,

you can achive the auto population of a field by using a formular field as described here:

It should be no big deal to auto-populate a field with the current user information. Formular Fields are what you need. 

Best Regards,

Robert ZentgrafRobert Zentgraf
Hi Sam,

you can use the global variable $User.Email in the formula field. Before this, check whether it's empty.

madhu navulurimadhu navuluri
Hi Sam,

The easy way is that go to text field and click on edit, you can see deafult value option in the field edit page.
put like " $User.Email " in the formula editor box. so it will display logged in user email address in the text field by default.

you can user formulas as well but the formula field is not display on the edit page. you can see the value only after save the record.