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 / automatic create a rec...
Power Apps
Unanswered

automatic create a record based on some conditions in the model driven

(0) ShareShare
ReportReport
Posted on by 26

Hello everyone,

I have an application contains on two entities ... what I need to do is when some conditions have done automatically create a new record in the another entity and take some data from the original entity ... is there any way to do it?

hope I explained the issue well .. thanks in advance

I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @MohammedWard 

    If you are using an edit form in entity1 (say named Form1) to input the original data you could use Patch() in the OnSuccess property of the form in entity1 to add some items from entity1 to entity2 by putting the following formula in the OnSuccess property of the edit form:

     

    Patch(entity2, Defaults(entity2), {targetfield1:Form1.LastSubmit.aname, targetfield2:Form1.LastSubmit.address, etc.})

     

    This patch would execute immediately on submission of Form1, creating a record in entity2 and putting data from a field from entity1 called aname into a field in entity2 called targetfield1 and data from a field called address in entity1 into targetfield2 of entity2 . It would be important to have the Patch in the OnSuccess property because you would not want it to execute unless the submission to entity1 was successful.  Naturally, you would change the name of "targetfield1"  and "targetfield2" to the actual names of the fields in entity2. 

     

  • Verified answer
    Joel CustomerEffective Profile Picture
    3,224 on at

    @Drrickryp  your solution is awesome but I think the question is regarding model driven apps.

     

    There are two ways to do that in a model driven app @Drrickryp . Real time workflow or Power Automate. 

     

    for Power automate Flow:

     

    create a solution

    add a flow to the solution

    choose common data service current environment connector

    select for trigger when a record is created, updated, or deleted. set it to the entity 1 and choose the when a record is created option.

    next step get records--get the record that triggered the flow. You want to do this because on create doesn't return all of the fields..

    then add a create step  choose entity 2 for the entity type, then map the desired fields.

    populate the lookup for entity 1 on entity 2, but be sure you use the right format. https://crmtipoftheday.com/1311/use-entity-name-in-flow-lookups/

     

    for real time workflow, you will need to click the gear and go to advanced settings-->processes. 

    Create a workflow and uncheck the run in background option.

    Choose entity 1 as the entity type.

    trigger to run on organization scope and run when record is created

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/configure-workflow-steps#:~:text=Table%201%20%20%20%20Action%20%20,to%20create%20...%20%203%20more%20rows%20

     

    I prefer flow, unless it needs to happen immediately. then use real time workflow. don't use background workflow, it will go away in the future.

     

    @MohammedWard  if this answers your question please mark it as a solution.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @jlindstrom 

    Of course you are right.  I overlooked the model driven reference. 

  • MohammedWard Profile Picture
    26 on at

    Thanks  

  • MohammedWard Profile Picture
    26 on at

    @jlindstrom  Thanks very much it's working

  • Joel CustomerEffective Profile Picture
    3,224 on at

    great to hear @MohammedWard . 

  • MohammedWard Profile Picture
    26 on at

    yes, that what I did  ... Thanks

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard