locked
Querying a record from 3rd party on which a sandboxed plugin operates RRS feed

  • Question

  • Hi All,

    I have a sandboxed plugin that is triggered on account update, this plugin connects to 3rd party service which in tern connects to the CRM via SDK and it performs a query that is trying to get the same account record, then the execution of the query gets on hold until the sandboxed plugin finishes the timeout (2 mins), at this point the plugin releases the record (timeout exception) and the query will be executed.

    I am working on large project built approx 4 years ago or more and the architecture of the code dictates that the logic is implemented on the plugins and the data access process (retrieve, update and create) is implemented on 3rd party service.

    If a plugin needs to get/update entity, it does this through the 3rd party service which connects to the CRM.

    In CRM 4.0, there is no problem in "On-Premises", but now we have an upgrade plan (moving to CRM 2011 online) and I am facing this problem, it is a limitation on the sandbox mode.

    Can anyone help please?

    Leave your answers ASAP, I don't have time :(

    Thanks

    Monday, July 1, 2013 10:02 AM

All replies

  • If the call the 3rd party service has to be a synchronous call, your plugin will need to run on a stage outside the transaction. This means one of:

    • Stage = 10, as a pre-event. The drawback of this is there is no guarantee that another plugin might cancel the original operation
    • Stage = 50, as a synchronous post-event. I think this is still possible, but it's deprecated
    • Asynchronously

    Alternatively, if your plugin does not need to receive a result from the 3rd party service, you may be able to call it asynchronously 

     


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

    Monday, July 1, 2013 10:28 AM
    Moderator
  • Thanks for your reply, but the plugin is registered on the post stage. Async mode can not help and also calling the 3rd party service async is not helpful here.

    I need it as is, registered on post stage and i want the 3rd party to get/update the record while the plugin is fired on that record..

    I want to ask, Is this a sandbox limitation since it was working with CRM 2007 ?

    Monday, July 1, 2013 12:41 PM
  • The difference is due to the plugin pipeline stages, not the sandbox.

    In CRM 4.0, you could only register a post-event on stage=50, which is outside of the database transaction. In CRM 2011, the post-event is stage=40, which is inside the transaction, and hence the database locks are maintained


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

    Monday, July 1, 2013 2:15 PM
    Moderator