Tuesday, 20 May 2014

CRM 2011 / 2013 Convert Late Bound Entity Class to Early Bound

In the plugin code, first you will get the Entity class :

// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters["Target"];

Sometimes, you need to have logic using Early Bound for this entity class for easier life.

Here you can achieve this :

//create target entity as early bound
Opportunity targetEntityEarlyBound = entity.ToEntity<Opportunity>();

*Opportunity is your Target Entity Class

Congratulation, now you can use the Early Bound for target entity on your plugin.

image

Hope it helps!

1 comment:

My Name is..