Tip #1236: Review RetrieveMultiple plugins before migrating to Unified Interface

It’s not uncommon to register a plugin on RetrieveMultiple message and fiddle with the output, e.g. drop some values, add some calculations, etc.

Chances are that you are changing the QueryExpression, and the plugin is working fine in the classic UI but you will have challenges migrating to Unified Interface.

The reason is that in the Unified Interface Dynamics 365 uses FetchExpression, so you’ll need to handle both cases if you want to use both classic UI and Unified Interface.

To reuse as much of the existing code as possible, use FetchExpressionToQueryExpressionRequest to convert, then do what you need to the QueryExpression, and then change it back with QueryExpressiontoFetchExpressionRequest. Sample code is available.

Thank you Guillaume Domont for the tip! (And don’t forget to send yours to jar@crmtipoftheday.com).

Cover photo by Lucas Vasques

2 thoughts on “Tip #1236: Review RetrieveMultiple plugins before migrating to Unified Interface

  1. Jonas Rapp says:

    Remember though that converting back and forth between FetchXML and QueryExpression impacts performance reasonably much, so going the extra mile to handle your query manipulation directly in the FetchXML is preferred.

  2. Sergii says:

    Hey Colleagues,

    I have an issue with MS for some time.
    And to be honest the question I have is the same – as an input I still have a query expression. As an output – collection.
    we use “Retrieve multiple” plugin as a data provider to call external service and fill in Virtual entity.
    MS Support can’t provide any explanations or documents.
    Can you please explain where this FetchExpression comes from and where it should be converted?
    (For the moment everything works fine except the fact that we can see only one line on the interface and the message 1-8 of N records. However, they can’t be reviewed)

    Thank you in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *