Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

Posted on by 425

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

}
}
}

}

}

*This post is locked for comments

  • Verified answer
    naresh babu Profile Picture
    naresh babu 425 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    I have solved by using another logic like getting lookupid and get the lookup attributes by using entity reference in plugin.

    if (entity.LogicalName == "lead")

               {

                           if (entity.Attributes.Contains("parentcontactid"))

                           {

                               var currency = ((EntityReference)(entity.Attributes["parentcontactid"]));

                               var actualCurrency = service.Retrieve(currency.LogicalName, currency.Id, new ColumnSet(true));

                               var currencyName = actualCurrency["firstname"].ToString();

                               var last = actualCurrency["lastname"].ToString();

                               entity.Attributes["firstname"] = currencyName;

                               entity.Attributes["lastname"] = last;

                           }

               }

               service.Update(entity);

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Process is described here : www.magnifez.com/pre-image-and-post-image-in-dynamics-crm-plugins-advanced-plugin-concepts-part-1  

  • Suggested answer
    Jharana Baliyar Singh Profile Picture
    Jharana Baliyar Singh 2,665 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Just try to login with dev app server there you can find with plugin registration tool & open it & login with your credentials & you can see the dlls already registered over there then update ur dll & register the images.

  • naresh babu Profile Picture
    naresh babu 425 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Can you describe how to add manually or automatically. In VS 2015,  i am unable to get new images register step.

  • naresh babu Profile Picture
    naresh babu 425 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Hi Jharana Baliyar singh,

    Thanks for your update.

    I tried with Plugin registration tool also but unfortunately the tool was not able to open new  assembly to add plugin assembly.

  • Suggested answer
    Jharana Baliyar Singh Profile Picture
    Jharana Baliyar Singh 2,665 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Hi NB,

    I have also faced this situation while deploying the images through register.xml via visual studio 2012 for crm 4.0 onpremise. So when I tried to deploy it was not updating correctly in the specific environment .Thus, manually I have updated the image & updated the dll through plugin reg tool for specific environment & try to debug.

    Thanks,

    Jharana

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Hi 

    You are missing the Entity Image registration, in your RegisterFile.crmregister file you should have the images. In your xml above, its empty and that's why you are not getting the  entity image.

    Your images tag should not be like this : <Images /> and it should be something similar to the following

    ScreenClip-_5B00_92_5D00_.png

    Hope this helps

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    please debug the code after making the suggested changes.

    https://dynamics365blocks.wordpress.com/2016/12/06/how-to-debug-a-plugin-in-dynamics-365-online-using-plugin-profiler/ 

  • naresh babu Profile Picture
    naresh babu 425 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    Thanks for update. i tried with this

    else

               {

                   throw new InvalidPluginExecutionException("Hola! An error occured in the plugin:");

               }

    the plugin tracelog is showing that the plugin is going into else part.

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Plugin for post images was deployed successfully. but deployed was not running on entity

    I remember there was an issue registering the plugin images or were not getting registered correctly using VS developer kit.

    I would recommend you debug the code to identify the error and fix it. if you dont have anything in the frontend.
    (i know the code above is not correct for accesing the images)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans