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 / Flow not triggering wh...
Power Apps
Suggested Answer

Flow not triggering when passing newly Created SharePoint List ID in Canvas App

(0) ShareShare
ReportReport
Posted on by 2
Hello,
 
I have a Canvas App, with a SharePoint list as a backend. I have to have different sperate attachment fields, to achieve this I am using a SharePoint document library. I have a flow that creates the attachments in the library + adds metadata, one of the metadata I want is the SharePoint list ID the attachments belong to.  When I hardcode the ID, the flow triggers and uploads files fine, when I pass the List Item ID dynamically however the flow doesn't trigger at all.
 
//Submit Button OnSelect Code
SubmitForm(Form1);
UpdateContext({ varNewRecordID: Form1.LastSubmit.ID });
 
 
//Form On Success
// 1. Loop through and upload all Datasheets
ForAll(Datasheets.Attachments, 'UploadAttachmentstoLibrary'.Run(Text(varNewRecordID),"Datasheet",
        {
            file:
            {
                name:ThisRecord.Name,
                contentBytes: ThisRecord.Value
            }
        }
       
    )
);
 
Is there a better way to achieve the same result? I'm condiering just pulling the ID from inside the flow using Get Items but was hoping there's a better way
 
I have the same question (0)
  • Kushal_M Profile Picture
    195 Super User 2026 Season 1 on at
    Hello ,
     
    Form1.LastSubmit.ID is usually the right approach, but the issue is timing. SubmitForm(Form1) is asynchronous, so your UpdateContext({ varNewRecordID: Form1.LastSubmit.ID }) can execute before the record is actually committed to SharePoint. That means Form1.LastSubmit.ID is blank or invalid when the flow runs, which is why the flow never triggers.
     
    You should move the upload logic into the form’s OnSuccess property, because OnSuccess only fires after the SharePoint item is successfully created and the ID exists. Try this structure instead // Submit Button OnSelect SubmitForm(Form1). Then in the form's OnSuccess:
    Set(varNewRecordID, Form1.LastSubmit.ID);
    // Upload Datasheets
    ForAll(
        Datasheets.Attachments,
        'UploadAttachmentstoLibrary'.Run(
            Text(varNewRecordID),
            "Datasheet",
            {
                file: {
                    name: ThisRecord.Name,
                    contentBytes: ThisRecord.Value
                }
            }
        )
    );
     
    A few important notes: Set() is generally safer here than UpdateContext() because it creates a global variable and avoids some screen-context timing quirks. Form1.LastSubmit.ID is only guaranteed to exist inside OnSuccess. If the flow parameter expects a number, remove Text() and pass varNewRecordID directly. Another thing to watch for, If Datasheets is an attachment control from an Edit Form, ThisRecord.Value can sometimes be problematic depending on the connector version. Some people instead use contentBytes: Value inside the ForAll.
     
    You do not need to do a Get Items in the flow just to find the ID if you already have it in Power Apps. Passing the ID directly is cleaner and more efficient.
     
    🏷️ Please tag me @Kushal_M, if you still have any queries related to the solution or issue persists.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
     Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
  • Suggested answer
    Kalathiya Profile Picture
    2,129 Super User 2026 Season 1 on at
     

    Form1.LastSubmit.ID is not always immediately available right after SubmitForm(Form1) executes, especially when the Flow is triggered very quickly afterward.

    So when you pass the id into variable, he variable may still be blank at runtime, which is why the flow does not trigger.

    Put below code on Form OnSuccess Property and try it. 

    UpdateContext({ varNewRecordID: Self.LastSubmit.ID });
    ForAll(Datasheets.Attachments, 'UploadAttachmentstoLibrary'.Run(Text(varNewRecordID),"Datasheet",
            {
                file:
                {
                    name:ThisRecord.Name,
                    contentBytes: ThisRecord.Value
                }
            }
           
        )
    );
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

    ​​​​​​​

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 875

#2
Valantis Profile Picture

Valantis 530

#3
11manish Profile Picture

11manish 432

Last 30 days Overall leaderboard