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 / Using 2 CDS entities a...
Power Apps
Answered

Using 2 CDS entities as data sources on one form?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee
Hi, Wondering anyone has experience saving data to 2 CDS data sources on one form. I am designing a PowerApp for Dynamics 365 Talent and the requirement is to save a new record on a form to 2 existing CDS entities. Let's call 'Worker Bank Account' entity the main driving entity. It has a one-to-many relationship to 'Bank Account Disbursement' via the field 'Bank Account'. The requirement is to put fields from both entities on one form so user can enter new bank account details. When the save button is clicked, a new record is created in both entities (linked by 'Bank Account'). Is this doable? I searched and so far what I found is a YouTube video showing how to save to the driving data source using some fields from another data source (and it only reads from it not writing any new data back) and another one showing how to write to 2 SharePoint lists with a one-to-many relationship by manually generating the linkage field. Thanks in advance.
Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    After quite of bit of searching I found the Patch or Collect may the way to meet this requirement.

     

    However, 'Bank Account Disbursement' has 3 required fields, 2 of them are lookup fields to other entities. 

     

    Found it hard to referennce the fields correctly. Tried the code like below and PowerApps keeps saying field name is invalid:

     

    SubmitForm(Form1);Patch('Bank Account Disbursements',Defaults('Bank Account Disbursements'), {cdm_bankaccountdisbursementnumber:"XXXXXXX",cdm_workerbankaccountnumber:AccountNumberValue.Text,cdm_companycode:LookUp(Companies,cdm_companycode="MA")});ResetForm(Form1)

     

    There is a blog here talking about using Patch to create records: https://sachinbansal.blog/2018/06/04/common-data-service-for-apps-canvas-app-update-patch-lookup-value-edit-form-does-not-update-lookup-value-on-submit-by-default-use-of-patch-function-part-6/, I followed the exact method and it didn't work.

     

     

     

     

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I ended up using Flow to do 2 inserts one after another.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard