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 :
Power Platform Community / Forums / Power Apps / Creating new child rec...
Power Apps
Answered

Creating new child records in cds entity from canvas app

(1) ShareShare
ReportReport
Posted on by 16

I have two custom entities: Entity1 and Entity2. There is a one (entity1) to many (entity2) relationship established. I have a canvas app with two gallerys; gallery1 to display entity1 records and gallery2 to display entity2 records based on the record selected in gallery1.

 

What is the best/recommended way to add a record to entity2 (child) in a way that establishes its relationship to a specific record in entity1(parent)?

 

I have a button and patch formula that saves all the required data and creates a new record in entity2, BUT it is not associated with any record in entity1.

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    eka24 Profile Picture
    20,925 on at
  • JFN Profile Picture
    16 on at

    Thank you. That post makes sense, but I am getting an error...

     

    I have attached screenshots of the entities and relationships. Below are the patch formulas. The first one saves the task request in the tasks entity but it is not associated with anything in the cases entity. I modified the patch formula based on the link that you sent but get an error.

     

    Patch( MemberFeedbackTasks, Defaults( MemberFeedbackTasks ),{'Task Request' : ti_TaskRequest.Text})

     

     

    Patch( MemberFeedbackTasks, Defaults( MemberFeedbackTasks ),{'Task Request' : ti_TaskRequest.Text},{'MemberFeedbackTasks':LookUp(MemberFeedbackCases,'MemberFeedbackCases' : dt_MostRecentCaseCreatedTaskScreen.Selected.MemberFeedbackCases))

     

    The "dt_MostRecentCaseCreatedTaskScreen.Selected.MemberFeedbackCases" is a reference to a data table column that contains data on the most recent case created.

     

    Thanks again for your assistance.

    powerapps_TasksEntity.jpg
    powerapps_CasesEntity.jpg
    powerapps_Relationship.jpg
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Two questions:

    1. From your 3rd image, it seems like both fields (lookup and unique ID) in the MemberFeedbackTasks entity have the same display name? If that's true, strongly suggest changing the display name of the lookup field to something else.

    2. Are you saying the 1st patch doesn't throw any error but the 2nd one does? If so, can you please share the error message?

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Hardit Bhatia
    https://thepoweraddict.com
  • JFN Profile Picture
    16 on at

    Worked perfect. Thank you.

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!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard