Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using 2 CDS entities as data sources on one form?

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.

Accepted Solutions
Not applicable

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

View solution in original post

Not applicable

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:, I followed the exact method and it didn't work.





Not applicable

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

View solution in original post

Helpful resources


Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users


We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (71,507)