Hi,
my logic is through plugin i entered some fields in account form
i have wright some code but code working record is not created. below copy my code.
using System;
using Microsoft.Xrm.Sdk;
namespace SecondPlugin
{
public class Class1 : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName != "account")
{
try
{
Entity followup = new Entity("account");
followup["name"] = "MS CRM";
followup["telephone1"] = "9036119324";
followup["emailaddress1"] = "Naresh@gmail.com";
service.Create(followup);
}
catch (Exception ex)
{
tracingService.Trace("FollowupPlugin: {0}", ex.ToString());
throw;
}
}
}
}
}
}
regards,
Naresh
*This post is locked for comments