Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

What PowerFX command should I use to update a Parent record via a custom button?

(1) ShareShare
ReportReport
Posted on by 2

Hi everyone!

 

I do not know if I am in the right place, but I need help with writing a command in Power FX to trigger a custom button in our model-driven app in PowerApps. I searched the internet but could not find the right solution.

Scenario:

I have created a custom button in the model-driven app on the table 'Opportunity Line'. I need this button to update a toggle on the parent Opportunity when a user uses this button (set it to true). As a result, a cloud flow will be triggered.

Currently, I am using this command, but when I click the button, nothing happens:

 

Patch(
    Opportunities, // Parent entity name
    LookUp(
        Opportunities,
        Opportunity = ThisRecord.Opportunity // Match the OpportunityID in the child record with the parent
    ),
    {
        'Convert to Sample Request': true
    }

)

 

I know I am doing something wrong but I don't know what, as I am very new to Power FX commands.

Thank you!

  • Verified answer
    Inogic Profile Picture
    Inogic 438 on at
    What PowerFX command should I use to update a Parent record via a custom button?
    Hi,

    This Fx formula will not work on your scenario as it get confused to which opportunity he wants to update. Use the below Power fx formula which will update the toggle field on the parent opportunity.

    Patch(Opportunities, Self.Selected.Item.Opportunity,{Forecast:'Forecast (Opportunities)'.Yes})

    In this formula Forecast is my toggle field in the Parent Opportunity which gets updated to ‘Yes’ when clicked on the button present in the Opportunity line.
     
    Inogic Professional Services
    An expert technical extension for your techno-functional business needs
    Power Platform/Dynamics 365 CRM
    Drop an email at crm@inogic.com
    Service:  https://www.inogic.com/services/ 
    Power Platform/Dynamics 365 CRM Tips and Tricks:  https://www.inogic.com/blog/ 
  • Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    What PowerFX command should I use to update a Parent record via a custom button?
    Hi Partner,
    Do you have to use Power FX command for this purpose?
    Maybe consider using a workflow or javscript?
    About Power Fx patch function, you can refer to the following documentation:

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans