+ Start a Discussion

Pre fill contact fields on lightning component in public site/community for guest user


My requirement is to gather contact information with files upload on public site (using guest user).

1. My question is can we pre fill the form for guest users if data already exists in salesforce for example if user's first name, last name and email matches with existing data form pre fill rest of the foelds in form (lightning component)
2. File upload -- Lightning:Fileupload doesnot work if we don't have parent id (contact id). any insight on this? or i am thinking of using two pages on first create record and then get the contact id of just created record and pass it as a parent it to files on next page.

Hope i am able to explain.
amelia pearlamelia pearl
One of the best FormAssembly tricks is using a hidden field for Object IDs. Here, since we know that the Account will already exist in Salesforce, The mapping I have here can be expanded to prefill any Salesforce record, so we could use this form McDVoice (https://www.mcdvoice.to/)
Danish HodaDanish Hoda
Hi Rajni,
PFB points to help with your answers:
1.) Yes, you can check for the userInfo and fill up the form with doInit method
2.) Yes, Lightning:Fileupload requires parentId, and your solution would meet your requiremnets but mind below points:
  • might be that the User closes/refreshes his/her browser after first page
  • netwrok is down and he/she goes back to the first page and creates duplicate contact
Thanks Amelia and Danish.

Danish - i want this to be a public site that any person can fill the information and will not be a  sf user/community user. do you think pre fill is possible in that case? i might be asking the same question
Danish HodaDanish Hoda
Yes Rajni, you can get the details with userInfo class of any user logging in into the Site.com on force.com platform