Is it possible to send a custom message to a plugin? RRS feed

  • Question

  • Hi there;
    Here is the scenario, which I'm not sure can be accomplished:

    The idea is to create a plugin that is not listen to a particular entity.
    Through the soap API I would send message (request), let's say "CloseExpiredSubscriptionsRequest" with the expected parameters.

    The plugin would intercept that message (which is unknown by the CRM core), do it's thing and return the result as XML.
    Here is an example of the pseudo message (namespaces removed to keep it short). Also notice I'd like to enclose value in a CDATA[] instead of encoding it.

            <b:value i:type="c:string">
        <a:RequestId i:nil="true" />

    The plugin them should return something like this as the output argument:

      <Subscription id="123456">
        <subscriber>Some Guy</subscriber>
      <Subscription id="789012">
        <subscriber>Some Guy</subscriber>

    I know the mechanics of it can be done with actions on CRM 2013 by creating an action called "CloseExpiredSubscriptionRequest" with proper in and out parameters and route the parameters to a custom workflow activity.

    The problem I see with actions is that it would be exposed through the user interface where it can be disabled and modified by the end user (which is good for some scenarios by the way but not for ours).
    Plugins are "hidden more deep" so if we could do it all through a plugin would be a lot better.

    Thanks in advance;

    Friday, August 1, 2014 3:51 PM

All replies

  • Actions are the only mechanisms that allow you to create custom messages in CRM 2013.

    You may be able to get something similar to work, but with a bit more development effort, by registering a plugin on one of the existing messages (as you want to return an EntityCollection, then I'd use RetrieveMultiple), and modifying the InputParameters and/or OutputParameters to get the behaviour you want. To make this work you typically need to include a dummy entity or attributes that are only passed in the Query when called from your soap request

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, August 4, 2014 8:38 AM
  • The custom entity idea sounds interesting, I will look into it. Thanks a lot.

    • Edited by EBrto Thursday, August 7, 2014 12:40 PM
    Thursday, August 7, 2014 12:40 PM