cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Champion
Community Champion

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

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

Highlighted
Microsoft
Microsoft

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

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.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,224)