web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Pass submitted form id...
Power Apps
Unanswered

Pass submitted form id to another form with button

(0) ShareShare
ReportReport
Posted on by 237

I have a canvas app that has two separate forms patching data to two different data sources. Form 1 is the parent form and has a one to many relation to the second form. In order for there to be a relationship, I need the same Form ID populated from the parent form to the second form.

 

Right now, I have the onsuccess property of the parent form to set a variable to the last submitted id:

NPatel12498_0-1685045796011.png

 

The ID field of the second form is set to the variable however, it keeps showing up blank. 

NPatel12498_1-1685045904572.png

 

Not sure how else to get the ID populated, but it shows blank every time the first form is submitted and navigates to the second screen to fill the second form. I should be able to submit the first form, navigate to the second form, and already have the ID populated from the first form that was submitted.

 

Any thoughts? Please let me know if more information is required. 

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    You can try this instead. Same idea but diff way to do it. 

     

    ClearCollect(lastItem: Submitform(FormName))

    then you can use lastItem.ID

     

    If that fails you can use a patch statement instead of submit form which will give you more control in the end. Here is an example of that:

    ClearCollect(lastItem, Patch(YourListName, Defaults(YourListName), {field1: "Value", field2, 4.432, field3: dropdown.selected.email}))

     

    This will submit a new record to the list called YourListName using the values passed in such as field1 and field2 etc. This will also save the object returned by SP (with the newly instantiated ID) into the lastItem collection. You can then access that like so: First(lastItem).ID

  • NP-18101421-0 Profile Picture
    237 on at

    Here is the patch function that I currently have for the submit button. It doesn't use on submit. 

    NPatel12498_0-1685049572569.png

    When this patch function runs successfully, it adds a row to the SharePoint list successfully. But, it doesn't take the id of the last submitted form when I set it in the second form.

  • Aaron_Morva Profile Picture
    38 on at

    Hey @NPatel12498,

     

    The sensible way would be to do it as @mmollet described. Another way to continue using the patch would be to retrieve the last ID of the SharePoint list you are patching to. The retrieval of the last entry must be done after your patch function and not before.

     

    UpdateContext(lastID:Last('Event Information').ID)

     

    now you can continue to use the ID in the app.

  • NP-18101421-0 Profile Picture
    237 on at

    Here is my code, I am doing something wrong it seems since there is a small error

     

    NPatel12498_0-1685628831862.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard