protected override void Execute(IPluginContext pluginContext) { var ctx = pluginContext.GetService <Microsoft.Xrm.Sdk.IPluginExecutionContext>(); var uow = pluginContext.GetService <Entities.IUnitOfWork>(); var pms = ctx.InputParameters; var target = ctx.InputParameters["Target"] as Microsoft.Xrm.Sdk.EntityReference; var name = (from c in uow.Contacts.GetQuery() where c.ContactId == target.Id select c.FullName).Single(); var sub = ctx.InputParameters["SubordinateId"]; }
/// <summary> /// Starting point of plugin execution. /// </summary> /// <param name="pluginContext"> Used for accesssing service and the target object </param> protected override void Execute(IPluginContext pluginContext) { // Note: Retrieve a ContactSerivce object. contactService = pluginContext.GetService <IContactService>(); Entities.Contact target; try { target = pluginContext.Target.ToEntity <Entities.Contact>(); } catch { return; } if (pluginContext.EventType == CrmEventType.Create) { // Functions that perform perticular task. } else if (pluginContext.EventType == CrmEventType.Delete) { // function that perform perticular tasks. } else if (pluginContext.EventType == CrmEventType.Update) { // function that perform perticular tasks. } }
protected override void Execute(IPluginContext pluginContext) { if (pluginContext.AttributeChanged("jobtitle")) { var full = pluginContext.GetFullImage().ToEntity <Entities.Contact>(); var target = pluginContext.Target.ToEntity <Entities.Contact>(); pluginContext.GetService <ServiceAPI.IContactService>().UpdateKing(full, target.JobTitle); } }
protected override void Execute(IPluginContext pluginContext) { var target = pluginContext.Target.ToEntity <Entities.Contact>(); pluginContext.GetService <ServiceAPI.IContactService>().UpdateKing(target); }