cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
larspeterson
Advocate II
Advocate II

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,844)