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 Pages / Clone record (Opportun...
Power Pages
Unanswered

Clone record (Opportunity) using PowerFX within a Model Driven App

(0) ShareShare
ReportReport
Posted on by 46
 

Hi All,

I have located several posts detailing how to Clone Records using PowerFX within Modern-Driven Apps (example link below) However, for some reason Im not able to Clone Opportunities, Accounts and Contacts work fine and I cant figure out why. I have checked and its not due to any Business Required fields at Opportunity level. Does anyone know if there is a reason why Opportunities will not Clone? Please see code below for Account and Opportunity

Opportunity Code:

ForAll(
Self.Selected.AllItems,
Patch(
Opportunities,
Defaults(Opportunities),
{
Topic: Self.Selected.Item.Topic & " (Copy)"

}

)

);

Notify(“The records selected have been cloned.”)

Account Code

ForAll(
Self.Selected.AllItems,
Patch(
Accounts,
Defaults(Accounts),
{‘Account Name’: Self.Selected.Item.‘Account Name’ & " (Copy)"}

)

);

Notify(“The records selected have been cloned.”)


https://techtweedie.github.io/posts/clone-with-powerfx-command-button/

Categories:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    try with Here is the PowerFX code for Opportunities:
     
    ForAll(
      Self.Selected.AllItems,
      Patch(
        Opportunities,
        Defaults(Opportunities),
        {
          Topic: ThisItem.Topic & " (Copy)",
          'Parent Account': ThisItem.'Parent Account',
          'Owner': ThisItem.Owner
        }
      )
    );
    Notify("The records selected have been cloned.");
     
  • Adam_Travers Profile Picture
    46 on at
    Hi,
     
    Many thanks for the response but unfortunately this does not work as it does not recognise the Parent Account column. I tried Potential Customer but I then get a polymorphic error and the same for the Owner field. 
     
     
     

     
     
     
     
  • Adam_Travers Profile Picture
    46 on at
    I have just tried this and whilst it does not error it does not clone the record either
     
    ForAll(
      Self.Selected.AllItems,
      Patch(
        Opportunities,
        Defaults(Opportunities),
        {
          Topic:ThisRecord.Topic & " (Copy)",
          'Potential Customer':ThisRecord.'Potential Customer',
           'Owner':ThisRecord.'Owner'
        }
      )
    );
    Notify("The records selected have been cloned.");
  • Adam_Travers Profile Picture
    46 on at
    Sorry my bad the last code I tried does work for me:
     
    ForAll(
      Self.Selected.AllItems,
      Patch(
        Opportunities,
        Defaults(Opportunities),
        {
          Topic:ThisRecord.Topic & " (Copy)",
          'Potential Customer':ThisRecord.'Potential Customer',
           'Owner':ThisRecord.'Owner'
        }
      )
    );
    Notify("The records selected have been cloned.");

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 Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard