A form published on a community page can be automatically prefilled with the username or email of a logged-in user pertaining to that community.
Let’s take a look at the setup.
1. First, we will need to configure a Lookup. In this case, the search takes place in the Salesforce User object, where the Salesforce field User ID has to match the salesforceUserID value.
This means that a check will be made to see if the logged user is identified in that community. The Salesforce fields returned are the ones that will be used in the next step.
2. Afterward, we have to map the fields that will be prefilled with the user’s information. The data should be loaded when the form is loaded, so make sure you choose that option.
Below, the Salesforce fields holding the user’s information will be associated with the form fields where the values will be displayed.
At this point, everything is set up. Just publish the form inside your community and take a look at how the form is prefilled with the relevant data.