Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Plugin for post images was deployed successfully. but deployed was not running on entity

$
0
0

I have deployed successfully into Dynammics CRM online version. when the records were added the plugin was not running.
Postimage plugin,

Update method 

Lead Entity

Below This is my code

public class PostOperationleadUpdate: IPlugin
{
public void Execute(IServiceProvider serviceProvider)

{

IPluginExecutionContext context = (IPluginExecutionContext)

serviceProvider.GetService(typeof(IPluginExecutionContext));

if (context.PostEntityImages.Contains("Target"))

{

Entity postMessageImage = (Entity)context.PostEntityImages["Target"];

if (postMessageImage.Attributes.Contains("parentcontactid") == true)

{
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
EntityReference customer = postMessageImage.GetAttributeValue<EntityReference>("parentcontactid");
Entity contact = service.Retrieve(customer.LogicalName, customer.Id, new ColumnSet(true));

contact.Attributes["firstname"] = postMessageImage.GetAttributeValue<string>("firstname"); //String Field
service.Update(postMessageImage);

}
}
}

}

}


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>