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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

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

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (46,287)