Prefilling Community Forms from Logged-in User

In this article we will demonstrate how with just a couple clicks, you can set up your community form to prefill data from your Logged in User.

First, you will want to ensure that your Remote Site Settings are configured properly

For the purpose of this article, we've already built our form. So now, let's publish it, and navigate to our publishing options.



From here, simply enable Dynamic Prefill, and you will be presented with some new options

Our form has a contact object, and provides us with an automatic set up for Dynamic Prefill:



**NOTE** This option only is presented if you have a Contact or User object in your form.

Once it has been set up, hit Save Prefill.

With Prefill in place, prefilling the details from the contact record, you can now log in to your community as a user, and see the details from their related contact record 

If you do NOT want to prefill based on the logged in User context, you can specify matching criteria on your primary object, and display records that are related to this object within the community



In the above example, any Contact record that is related to an account named "Test2000" will be prefilled here.
 

How to setup remote site settings to make prefill for communities work


Get the community URL where you are going to add lightning component.
  1. Go to Setup> [Quick find] All Communities 
  2. You will see list of communities in your org. See screenshot below.
  3. Copy the link text listed under URL section of your community. (e.g. https://yourcommunity.na59.force.com/mycommunity)

White-list the URL so that Formstack can make REST API calls through that URL.
  1. Go to Setup> [Quick find] Remote Site Settings
  2. Just confirm if the community domain is listed here.
  3. If not, then click on New and do the following:
    1. Remote Site Name: i.e. FormstackUrls_CommunitySite
    2. Remote Site URL : <Community Site URL' Domain> i.e. https://yourcommunity.na59.force.com
    3. Description: Community site base url for Formstack app to make REST API accessible to community prefill feature

NOTE:
  1. If your form is Admin Context then you also need to add login.salesforce.com or test.salesforce.com
  2. If you are using custom domain then you need to consider that domain for whitelisting 
For more information regarding Remote Site Settings, please see the article linked here
Screenshots:


Was this article helpful?

295a6682296ed601774749fedcc7750c@formstack.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete