CRM 2011 Update Plug-in: Which Fields Changed

dynamics-crm-2011

How can it be determined in a synchronous plug-in which fields changed?
The plug-in is registered on update.
Something like an isDirty() in JavaScript:

// TODO: Implement your custom Plug-in business logic.
IOrganizationService service = localContext.OrganizationService;
Entity account = (Entity)localContext.PluginExecutionContext.InputParameters["Target"];
if (account.GetAttributeValue<String>("address1_latitude").isDirty())
{
    service.Create(new Lead { FirstName = "LOCATION CHANGED" }); // this is a stub
} 

Best Answer

The attributes that are actually present in the Target are the ones that have changed. Unchanged attributes don't appear there.

Related Topic