cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
arthurzhu
Level: Powered On

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.
1 ACCEPTED SOLUTION

Accepted Solutions
arthurzhu
Level: Powered On

Re: Using 2 CDS entities as data sources on one form?

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

2 REPLIES 2
arthurzhu
Level: Powered On

Re: Using 2 CDS entities as data sources on one form?

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

 

 

 

 

arthurzhu
Level: Powered On

Re: Using 2 CDS entities as data sources on one form?

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

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 207 members 3,190 guests
Please welcome our newest community members: