Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CRM 2011 Update Plug-in: Which Fields Changed?

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
} 
like image 936
Bvrce Avatar asked Mar 26 '13 10:03

Bvrce


1 Answers

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

like image 131
TeaDrivenDev Avatar answered Oct 24 '22 04:10

TeaDrivenDev