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 / Edit record OnSelect, ...
Power Apps
Answered

Edit record OnSelect, and/or pre-populate edit form based on gallery selection

(0) ShareShare
ReportReport
Posted on by 100

Hi all,

 

Two questions here, maybe connected. For context, I'm building an app that connects to our company's Dynamics instance and pulls time entries from PSA (CDS in PowerApps). My first screen is a gallery that displays unapproved time entries, based on some filter criteria. Picture of the gallery below:

 

RMDNA_0-1616433522136.png

 

Question 1: ideally, when I hit "Approve" it would take that record, change the data field RecordStage to "Approved", and submit that change to the data source. Can you edit a record in a button OnSelect and then submit the change without needing to go through a whole Edit Form? If so, how (in broad terms)?

 

Question 2: if I do need to go through an edit form, I'd have the button take me to a different screen. For example's sake, I'm using the default Form screen. After I change some of those to text displays rather than edits, how do I pre-populate them with the data from the gallery entry I used to get here? Example: if I clicked "Approve" on the entry from the pic above, I would want 3/19/2021 to automatically show in a Date card, their name in a Name card, etc.

 

RMDNA_1-1616433755381.png

 

Thanks!

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @RMDNA 

    For question 1:

    Yes, you can perform an UpdateIf on that button.  ex: UpdateIf(yourDataSource, ID=ThisItem.ID, {RecordStage: yourNewValue})

     

    For Question 2:

    You need to make sure your Item property of your Form is set to the Selected Item in the Gallery.  ex: yourGallery.Selected

     

    I hope this is helpful for you.

  • RMDNA Profile Picture
    100 on at

    @RandyHayes - thanks for the quick reply!

     

    I know the "ID" part is wrong, since I'm testing the rest of it, but I'm getting a data type mismatch. Is that type that's assigned in the actual data, or something that I can "fix" in PowerApps itself? 

     

    RMDNA_0-1616435022045.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @RMDNA 

    The ID part seems fine.  The issue with that formula is that your Record Stage is an option set.  So, you cannot set it with a text value, you need to use the appropriate option set value.

  • RMDNA Profile Picture
    100 on at

    @RandyHayes: sorry, I should have been more clear - I'm unfamiliar with option sets. 

     

    How would I refer to an option set value in your formula (or, what goes after the colon in {RecordStage: }) in order for it to work? The valid values for RecordStage are Approved, Submitted, Recalled, etc.

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @RMDNA 

    You will need to have your formula like this:

    UpdateIf('Project Approval', 'Project Approval' = ThisItem.'Project Approval', {'Record Stage': 'Record Stage (Project Approvals)'.Approved)

    Now, this might vary depending on the actual names in your table.

    Utilize "Intellisense" in the formula editor to help you find the actual names.

  • RMDNA Profile Picture
    100 on at

    Took a bit more work, but I was able to get writeback to Dynamics. Many thanks!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard