using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk; using System.ServiceModel; namespace Plugincode { public class DelRecords : IPlugin { public void Execute(IServiceProvider serviceProvider) { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = factory.CreateOrganizationService(context.UserId); if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"] is EntityReference)) { if (context.MessageName == "Delete") { Entity Contact = new Entity("contact"); service.Create(Contact); } } } } }
↧
is this code correct ? plugin code i have written to delete account entity record and create contact record automatically
↧