Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

i am getting this error given key is not found

$
0
0

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");
}
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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