Technical Fun

CRM 4.0 Plug-In: Getting Entity Id (Is it just me or? …)

Posted on: May 21, 2008

Holla, Ok, I am new to the world of CRM 4.0 Plug-Ins, and even though I wrote many callouts for CRM 3.0, that does not count to the experience. So, I am a flat newbie 🙂 [excuse mode ON].

Here’s the story; I was trying to hook to a post update event of the opportunity entity, and naturally wanting to do something based on the opportunityid I (should have) obtained easily.

Here’s the un-easy part;

Microsoft.Crm.Sdk.DynamicEntity opp = context.PostEntityImages["opportunity"] as Microsoft.Crm.Sdk.DynamicEntity;

and afterwards, I could call the Id (GUID) of the opportunity like this;

Microsoft.Crm.Sdk.Key okey = opp["opportunityid"] as Microsoft.Crm.Sdk.Key; Guid oppid = okey.Value;

Hmm… before I got here, I tried to use and register PreEntityImages, but failed. I tried to use OutputParameters of the context, and failed as well.

So, for post events, I’ll stick to this PostEntityImages thing.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: