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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Getting around not bei...
Power Apps
Suggested Answer

Getting around not being able to use Set() in a PowerFx command button

(2) ShareShare
ReportReport
Posted on by 8
Hi everyone-
 
I'm creating a command button to be able to take information from a parent/child set of records and copy it to a different table as a parent/child set of records. Since I can't use Set() in the PowerFx command buttons, is there some kind of workaround to capture the GUID of the record that is getting created by the Patch() function?
 
Am essentially trying to see if I can duplicate the functionality of the Opportunities/Quotes in D365 in my custom Power Apps app. I want to copy all of the line items from the Opportunity to the Quote line items. I can get everything else created in the Quote except the line items. I don't know how to grab the GUID of the quote created.
 
Thanks.
Joe
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi,
     
    Sorry I am confused. You have a Canvas App, why are you not able to use the Set, or you can even use ClearCollect, for a patch and have it capture the information about the new record.
     
    Why does it not work?
  • Suggested answer
    nirace Profile Picture
    9 on at
    Hi,
     
    If you want to collect response from Patch, here's how I would do it
     
    Set(responseVar, Patch(...));
     
    Use it like
     
    reponseVar.ID
     
     
    It you are using ForAll to Patch, use collect inside ForAll to collect all responses from the Patch. 

    Hope I was able to steer you somewhere.
    Thank you. 
     
  • JM-06052229-0 Profile Picture
    8 on at
    Thank you both for your answers! I realized after I read these I wasn't clear enough in my original question.
     
    Am making a button in a model-driven app and Set(), Collect() and ClearCollect() aren't supported.
     
    There HAS to be some kind of workaround for this.
     
    Joe
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Maybe but like everyone who posts, the posts lack details which would be easy NOT to do since its your issue.
     
    And we wasted time. 
     
    Explain again what you want. I'll look at it later today.
  • JM-06052229-0 Profile Picture
    8 on at
    I'm looking to take child records from a parent table and copy them to a different child table of a different parent table.
     
    Almost exactly how D365 copies all of the Opportunity line items when you create a quote from the Opportunity -- it copies all of the line items to the Quote line items.
     
    My issue is the command button in a model-driven app does not support the Set() function. I can use the Patch() function to create a new quote, but I need the GUID of the quote just created to be able to link the items to the newly-created quote.
     
    Joe

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard