locked
Connect to the transactional email servicebus queue from CRM. RRS feed

  • Question

  • Hi!

    I am trying to connect to the MDM transactional email servicebus queue from whitin CRM. I have created a workflow that automatically sends the RecipientEmailAddress and the email template id to the servicebus queue when a new contact is created. This works fine when the CRM is Onpremise, unfortunately it will not run on CRM Online. I imagine it might be because of some restrictions in the sandbox environment. So far I have been using the Microsoft.Servicebus.dll library located in the MDM SDK to connect to the transactional email queue.  

    So my question is; Is there an alternate way of sending information and trigger an transactional email in MDM from within CRM? 


    Thanks

    Thursday, June 23, 2016 9:13 AM

All replies

  • Have you tried IL Merge  tool? Not sure if this will work for you.
     

    ILMerge is a tool for merging multiple .NET assemblies into a single .NET assembly. Using this tool you could merge your Microsoft.Servicebus.dll with your workflow or plugin assembly.

    Thanks,

    Sam


    Inogic | Blog | news@inogic.com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Friday, June 24, 2016 10:44 AM
  • Thank you for your reply.

    Yes, I have merged the multiple assemblies into one assembly with Ilmerge and it works as it should when deployed to an onpremise installation of CRM. But when running on an CRM online instance t fails trying to access some the methods located in the Microsoft.Servicebus assembly, this is the exception being thrown:

     <Message>Unexpected exception from plug-in (Execute): EmailMarketingMessage.MarketingMessageHandler: System.TypeInitializationException: The type initializer for 'TimerManager' threw an exception.</Message> <Timestamp>2016-06-22T09:04:46.2854174Z</Timestamp> <InnerFault> <ErrorCode>-2147220956</ErrorCode> <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /> <Message>Attempt by method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer..ctor()' to access method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer+TimerHelper.CreateWaitableTimer()' failed.EmailMarketingMessage.MarketingMessageHandler: System.MethodAccessException: Attempt by method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer..ctor()' to access method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer+TimerHelper.CreateWaitableTimer()' failed.</Message> 




    Friday, June 24, 2016 2:05 PM
  • I'm having the same problem connecting to a service bus from a CRM Online plugin. I get the following error

    Exception: System.TypeInitializationException: The type initializer for 'TimerManager' threw an exception. ---&gt; System.MethodAccessException: Attempt by method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer..ctor()' to access method 'Microsoft.ServiceBus.Common.IOThreadTimer+WaitableTimer+TimerHelper.CreateWaitableTimer()' failed.

    I found this code on google (I don't know if it's what is being used) and it looks like a security/lack of permissions, see line 631 and 650 of https://github.com/Reactive-Extensions/IL2JS/blob/master/Tests/Microsoft.ServiceBus.Messaging/Common/IOThreadTimer.cs

    It seems we cannot use the service bus from plugins, we have to use azure aware plugins. But that doesn't work very well in all scenarios, for example when a separate system you have to integrate wants to read a message coming from an azure aware plugin, it has to reference the CRM SDK to read the SDK's RemoteExecutionContext which couples that system to CRM.

    Tuesday, October 4, 2016 1:07 PM