I have an entity called Samples. Inside that I have many fields, one of them is a ProjectLocation drop down list.
Now I use this code to insert a new instance of type Sample in the CRM through WCF.
Entity sample = new Entity("new_sample");
sample.Attributes["name"]= "Ahmed";
This works but when I want to enter the ProjectLocation I don’t have any idea how should it be accomplished.
This doesn’t work.
Entity projectLoc = service.Retrieve("projectlocation", (new guid here), columnset)
sample.Attributes["new_projectlocation1"] = projectLoc
What can be done?
You need to change your code to return an EntityReference, here is the updated code: