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 :
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
    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
    766 on at
    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
11manish Profile Picture

11manish 58 Super User 2026 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 48 Super User 2026 Season 2

#3
Subra Profile Picture

Subra 42 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans