web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Retrieve & RetrieveMultiple Plugins in V9

(0) ShareShare
ReportReport
Posted on by 1,266

Hi all

We have some translation plugins triggering on Retrieve and RetrieveMultiple, as detailed here by superb Scott Durow (https://www.develop1.net/public/post/2013/01/05/Multi-Language-Lookups).  Having recently upgraded to v9 and more recently v9.1 we're experiencing issues with plugins not registered on particular events event firing.  

To explain the issue let's take the following console app:

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ICSCEConsole
{
    class UpdateTesting
    {
        IOrganizationService _service;

        public UpdateTesting(IOrganizationService service)
        {
            this._service = service;
        }

        public void updateRecords()
        {
            // Instantiate QueryExpression QEquotedetail
            var QEquotedetail = new QueryExpression("quotedetail");
            QEquotedetail.TopCount = 100;

            // Add columns to QEquotedetail.ColumnSet
            QEquotedetail.ColumnSet.AddColumns("description");

            // Define filter QEquotedetail.Criteria
            QEquotedetail.Criteria.AddCondition("createdon", ConditionOperator.Today);


            var results = _service.RetrieveMultiple(QEquotedetail).Entities;

            Console.WriteLine("Retrieve {0} records at {1}", results.Count, DateTime.Now);

            foreach(Entity quotedetail in results)
            {
                Entity qd = new Entity("quotedetail");
                qd.Id = quotedetail.Id;
                Console.WriteLine("Updating qd at: {0}", DateTime.Now);
                _service.Update(qd);
                Console.WriteLine("Finished qd account at: {0}", DateTime.Now);
            }

        }
    }
}


As you can see I'm simply performing an empty update against any quotedetail records created on today.  Against 8.2 and 80 records this takes in the region of 6 seconds and generates a single plugin trace log against RetrieveMultiple of quotedetail, as expected.  

When I run this against v9 updating a similar number of records takes over 8 minutes and generates almost 10,000 plugin trace logs for the following:

primaryentity

messagename

productpricelevel

RetrieveMultiple

product

Retrieve

product

Retrieve

quote

Retrieve

quotedetail

RetrieveMultiple

quotedetail

Retrieve

As a result plugin performance in v9 is outrageous with various timeout issues.  

I've opened a ticket with Microsoft regarding this issue but in the meantime would be interested to hear if anybody else has experienced similar issues and managed to find a resolution?

Thanks in advance for any assistance anyone is able to provide.

Cheers!

Luke

*This post is locked for comments

I have the same question (0)
  • PranavShroti Profile Picture
    4,510 on at

    Hi Luke, is it possible to test plugin by making it Asnyc ? Is it even possible in your business scenario ?

    Regards,

    Pranav

  • Luke Sartain Profile Picture
    1,266 on at

    Hi Pranav

    Unfortunately these need to be synchronous.  Upon further investigation I have found that Retrieve and RetrieveMultiple plugins now appear to be triggering on update commands (_service.Update(qd) as shown above).  This never happened in previous versions so am awaiting a response from Microsoft as to whether this is now by design.  

    Luke

  • PranavShroti Profile Picture
    4,510 on at

    it will be interesting to find out... please share MS response and close the community thread.

    Regards,

    Pranav

  • Community Member Profile Picture
    on at

    Any answer from Microsoft?

  • Luke Sartain Profile Picture
    1,266 on at

    Yes, we've had an update.  After many arduous weeks of doing the obligatory checks of our plugin code and customisations, Microsoft eventually escalated the ticket to the product team who, within minutes of looking at the trace logs on the server, discovered that it's not a problem with the retrieve multiple plugins but rather a bug with updating and retrieving quote detail lines whereby any update or retrieve, regardless of field, is triggering the system pricing calculation to execute.  For us, when we updated sequence numbers on a product bundle it went from taking 2-3 seconds for a 50 product bundle to in excess of 2 minutes.  Unfortunately a fix is "some weeks away" as of last week and in the meantime we have been advised to turn off system pricing calculation in system settings and instead write our own plugins for pricing calculations.  We've done this and can confirm that this has indeed improved performance.  The aforementioned scenario now takes ~12 seconds. Whilst not at 8.2 speed, it does mean that our users are now no longer screaming whilst using Dynamics.  

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans