Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

LINQ query to get the first contact?

$
0
0

Hi, I have a plug-in with a LINQ query to get the parent contact of an opportunity:

var tempContact = (from c in ServiceContext.CreateQuery("contact")
	where c.Id.ToString().Equals(contact_guid)
	select c).FirstOrDefault();

Where "ServiceContext" is defined as:

IOrganizationService service = localContext.OrganizationService;
var ServiceContext = new OrganizationServiceContext(service);

I get an error message saying that the query is incorrect. Any suggestions?

Or other query suggestions would be appreciated as well, I'm only doing this with LINQ because that's the only approach I know. I just need to get the contact associated with the opportunity, thanks.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>