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 / Update a Variable to T...
Power Apps
Answered

Update a Variable to ThisItem after Submit form

(0) ShareShare
ReportReport
Posted on by 37

I am trying to update a variable after submitting an edit form.  I am looking for something like "OnSuccess:UpdateContext({Variable:ThisItem})"  or "OnSuccess:UpdateContext({Variable:LookUp('[dbo].[Table]',ClientID=EditForm.LastSubmit.ClientID)})"

 

The ClientID is a required unique key in an Azure database.

 

I already have a variable that updates a display form with "OnSuccess:UpdateContext({Variable2:EditForm.LastSubmit})", but this language does not update the item which other parts of the app rely on.

 

Thanks for any help.

Categories:
I have the same question (0)
  • Meneghino Profile Picture
    6,949 on at

    I don't use forms, but your second proposed piece of code should work (except it may be slow but can probably be speeded up)

    If you need to use the value in other screens of the app then you need to use a global variable like this:

    OnSuccess = Set(Variable, LookUp('[dbo].[Table]',ClientID=EditForm.LastSubmit.ClientID))

    If this is not what you are looking for, please be more specifc about the issue you are having.

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @diannottismh,

     

    Do you need any further help on this?

    As @Meneghino suggested, please switch updatecontext() function to Set() function, if you would like teh variable to work under other screens.

    For the function reference, please check:

    Set() function in PowerApps

    Understand variables in PowerApps

     

    Regards,

    Michael

  • Verified answer
    diannottismh Profile Picture
    37 on at

    I added an "If" statement to the onsuccess statement only updating the variable if the record was a new record.  This worked.  For some reason the update variable did not work when it could be either a new record or an existing record.

     

    Thanks for the help

  • duncant Profile Picture
    278 on at

    What would that look like?

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard