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

Patching a CDM Lookup Field

I hope this is just an easy answer, but I couldn't find any documented issues or answers within the forum.

I am attempting to patch a Lookup field in the common data model when I press a button. I am able to patch most fields, but cannot patch any LookUp fields. 

 

My formula is simple: Patch(Account,Defaults(Account),{PrimaryContact: Last(Contact).ContactId})

 

Surely we can patch LookUp fields in the CDM?

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Level 10

Re: Patching a CDM Lookup Field

Hello @larspeterson

 

Yes it is possible to patch lookup fields in CDS (new name for CDM)

 

Basically you need to patch a record and not a single value (this also seems strange to me, but that is the way it is)

 

So in your case, this should work:

Patch(Account,Defaults(Account),{PrimaryContact: Last(Contact)})

I also tried to reduce the record to the minum fields required, and in my case the record needs to contain at least the PrimaryId and another field called the Title field, so basically not all the fields of the record are necessarily needed.

 

Please let me know how you get on.

View solution in original post

2 REPLIES 2
Meneghino
Level 10

Re: Patching a CDM Lookup Field

Hello @larspeterson

 

Yes it is possible to patch lookup fields in CDS (new name for CDM)

 

Basically you need to patch a record and not a single value (this also seems strange to me, but that is the way it is)

 

So in your case, this should work:

Patch(Account,Defaults(Account),{PrimaryContact: Last(Contact)})

I also tried to reduce the record to the minum fields required, and in my case the record needs to contain at least the PrimaryId and another field called the Title field, so basically not all the fields of the record are necessarily needed.

 

Please let me know how you get on.

View solution in original post

Sachinbansal
Level: Powered On

Re: Patching a CDM Lookup Field

Hi @larspeterson

Please refer below link which explains how to patch Lookup field in CDS with example

 

https://community.dynamics.com/365/b/sachinbansalmicrosoft/archive/2018/06/03/common-data-service-fo...

 

Regards

Sachin

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 231 members 6,234 guests
Please welcome our newest community members: