Showing results for 
Search instead for 
Did you mean: 
New Member

Create/Update Records is not working with Lookup (EntityReference) field



I have created console application and tried to connect Dynamics 365 using Microsoft.Powerplatform.Cds.Client (.net core package) and everything is working fine. I am also able to fetch the records from Dynamics. 


I have tried to create the records with only Name field - for e.g. account["name"] then it is working fine and new records are created in Dynamics. But when I tried to set lookup field - for e.g. dummyentity["test_accountid"] = new EntityReference("account", <GUID of Account>) then it gives below error

Message=Operation returned an invalid status code 'BadRequest'

I already verified the field names and GUID also exists in dynamics.


Can you please help me out here?

Thanks in advance!



Hardik Shah

Advocate I
Advocate I



Thanks for quick response. 


Yes it seems the same issue in other thread. I tried lots of thing but it is not working with lookup fields.



Hardik Shah

Community Support
Community Support

HI @hardik_486 ,

How do you update the LookUp field in your Account Entity? Using Microsoft.Powerplatform.Cds.Client?


Please make sure the 'test_accountid' is the logic name of the LookUp field in your Target Entity. Please go to the CDS in your PowerApps, then find your Target Entity, then find the logic name of the LookUp field, rather than go to your Dynamics CRM.


According to the issue that you mentioned, I think this issue may be related to this ALPHA version -- Microsoft.Powerplatform.Cds.Client -Version 0.2.14-Alpha.


Please consider submit an assisted support ticket through the following link for further help:



Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,334)