cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tim10
Regular Visitor

How to populate a form's choice from a previous form submission

Hello

 

I have 2 lists in Sharepoint: 

BasicInfo (ID, Name, CompanyName)

COVIDResponse (basicInfoID, Question1, Question2, Question(n+1) ..)

 

I have set COVIDResponse.basicInfoID to be a Lookup against BasicInfo, and set this as a required field.  On the sharepoint end of things, this works great - I must enter the data in BasicInfo first, then I am able to create a row in COVIDResponse - first selecting the correct basicInfo record before being able to create the COVIDResponse record.

 

I am trying to make a Powerapp for my users to use.  I've created the BasicInfo form without issue - data submits, etc.

 

On the next screen, I want to present the COVIDResponse fields.  Since I've made COVIDResponse.basicInfoID required, I need to know how to set it from the BasicInfo submission.

 

I have tried following https://wonderlaura.com/2017/08/16/powerapps-set-sharepoint-lookup-field/, but she's pre-populating (and pre-selecting) a field in a select list.  This method didn't seem to work in my application.

 

I have tried using the Lookup() function (following loosely on https://powerusers.microsoft.com/t5/Building-Power-Apps/Auto-populate-fields-based-on-the-users-inpu...) by settings the Items value to "LookUp('Basic Visitor Information', ID=BasicVisitor_Form.LastSubmit.ID)", but this resulted in an error - Items is looking for a Table value, and lookup returns a single record.

 

Help? 🙂

 

Thanks,

 

Tim

12 REPLIES 12
Tim10
Regular Visitor

Correct - 2 forms, on 2 different screens of the app.  1st form sets varLastSubmit onSuccess, and 2nd form is the one generating the error when I submit the form.

 

I added a custom datacard to the form, and set its datafield to "BasicVisitorID".

 

I added a TextField to that card, and set its default value to "varLastsubmit.ID". 

 

When I move from the 1st screen to the second screen, I see the generated ID in the textfield.  Upon submission of the 2nd screen of the app is where I am seeing the "BasicVisitorID: Field "BasicVisitorID" is required." error message.

eka24
Super User III
Super User III

I think you didn't get suggestion. Read my last message again. Delete the Datacard which is a dropdown and insert a new one, this time not a dropdown but with just a textfield. After deleting, it be as if you are now adding a new field to your form. 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Tim10
Regular Visitor

I don't get a choice as to the field type when I add the field - I am adding a field from a data source, and it comes in predefined as complex.

 

I found a thread at https://powerusers.microsoft.com/t5/Building-Power-Apps/Set-Default-Value-for-Lookup-Field-in-New-Fo... describing the exact problem I am having, and applied the solution there.  Seems to work so far!

 

Thank you again for your help with this, and apologies for not being clear on the exact issue I was encountering.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,105)