cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

AutoFill a Form from previous records?

Hi 

 

So my project is done and dusted - I have created a visitor registration app from powerapps, everything is working smoothly then I was hit by a question which i haven't thought about in the first place. 

 

"Is there a way so that frequent visitors won't have to fill in the form everytime they come in?"  - facepalm

 

backstory is I have a sharepoint list with visitor records to whom the "Form" is connected to, the Form updates the sharepoint list whenever someone logs in with their name, company, phone number and person they want to visit. They log out, the column gets updated with the current date and time. Gallery does not show the records whose log out column is already filled in.

 

The big question is, is it possible to autofill a form with previous records of people who have visited? like a history? How will this be pulled off with Powerapps? I think you can only connect one data to a Form. This is the last hurdle from my project and any help will be greatly appreciated.

 

Kind regards

 

Chrom3d

 

 

7 REPLIES 7
Highlighted
Community Champion
Community Champion

Hi @Anonymous

Yes, this can be done.

Obviously the details depend a bit on what exactly it is you want to do, but for example you can use the StartsWith() function to query the history list using the person's name and get the data of the last record in the history list.

However, this may require customisation of any forms that you have in your app.  I generally prefer not to use forms at all but create my own form the individual controls.  Once you start customising the out-of-the-box froms, it is often easier to start from scratch.

Highlighted
Community Support
Community Support

Hi @Anonymous,

 

Meneghino offers a workable way to deal with the situation, to filter the table first, and then get the last record. 

Formula should be:

Last(filter(SPList, UserName=User().FullName))

To work with Form control, and to have the value auto-filled by the previous record submitted by the same person, we need first find the record, and then specify the value to the Default property of the corresponding DataCard control.

For example, under the Company DataCard of the Editform control, and we would like the value to be auto-filled with the Company name last submitted by the same user, we configure the Default property of the Company DataCard control with the formula below:

 

 

If(
   !IsBlank(filter(SPList, UserName=User().FullName)),
   Last(filter(SPList, UserName=User().FullName)).Company,
    "")

Formula here means if the user has records submitted, it will then display the company last submitted, if not, it will display nothing.

Configure the same way for the other DataCard.

Let me know if it works.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Thanks for the suggestion, this makes sense to me now alotugh not 100% yet. I've never tried this before and will try to crack it when I get the chance. Will let you guys know how it goes!

 

just question on the formula, I have to apologize again for being a code newbie

 

Last(filter(SPList, UserName=User().FullName))

 

"SPList" = Sharepoint list which is obvious 

 

 

"UserName =is the column?

"User().FullName"  = says in the manual "Full name of the current user, including first and last names." I I am not pulling any users from let's say Office365, it's just random people from diff institutions and they might just put in Jake or Bob instead of their full names. Would there be an alternative instead of using "User().FullName" or is it the correct syntax which pulls in data in Sharepoint that is labeled as name?

Highlighted
Anonymous
Not applicable

I forgot to ask too where should I put this formula? 

 

Last(filter(SPList, UserName=User().FullName))

 

on the VisitorName DataCard's default data? Same as the location of

 

If(
   !IsBlank(filter(SPList, UserName=User().FullName)),
   Last(filter(SPList, UserName=User().FullName)).Company,
    "")

 

In the company's data card 

Highlighted

Did you manage to work this all out?

Highlighted

Hey @Anonymous,

 

 

The Last function is already used in the If statement so you dont need to put it elsewhere.

UserName is a context variable that is initialized on the OnStart or OnVisible of the first screen you show to your endusers.

So something like this: UpdateContext({UserName: User().FullName})

 

Kind regards

 

 

Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Highlighted
New Member

Hi @Anonymous 

I am doing a similar project to yours. I am new to PowerApps and coding. I am currently stuck on autofill date and time of visitors. is there a way you can share your app model with me, so that i can see your method of solving this model ??

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,547)