I am using images can anyone help me
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory servicefactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = (IOrganizationService)servicefactory.CreateOrganizationService(context.UserId);
if(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
if (context.MessageName.ToLower() == "update")
{
Entity contact = context.InputParameters["Target"] as Entity;
Entity PreImagecontact = context.PreEntityImages["Preimage"] as Entity;
if (contact.Attributes["fullname"].ToString() == PreImagecontact.Attributes["fullname"].ToString())
{
throw new InvalidPluginExecutionException("jobtitle is not changed");
}
else if (contact.Attributes["fullname"].ToString() != PreImagecontact.Attributes["fullname"].ToString())
{
throw new InvalidPluginExecutionException("jobtitle is changed");
}
}
*This post is locked for comments