web
You’re offline. This is a read only version of the page.
close
Skip to main content
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!

I have the same question (0)
  • Leah Ju Profile Picture
    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:
  • Verified answer
    Inogic Profile Picture
    651 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/ 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 72 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 58

#3
Martin Dráb Profile Picture

Martin Dráb 54 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans