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.

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.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,122)