locked
CRM 4.0 - Call plugin from stored procedure? RRS feed

  • Question

  • Hi All,

    I am using CRM 4.0. What my requirement is, i need to prepare SQL job which will update status of opportunity to close if its not modified since 1 year and create one history record in this. But my problem is, I have some plugins registered on opportuniy close. So is there any way to call plugin from stored procedure?

    Or any other way i can achieve this?

    Tuesday, September 10, 2013 1:37 PM

Answers

  • Ravi,

    Build a console application that checks the conditions & performs the desired operations. You can then schedule this console application using windows scheduler.

    Here is a walkthrough to build a console app for CRM.


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Marked as answer by Ravi MRC Wednesday, September 11, 2013 6:03 AM
    Tuesday, September 10, 2013 2:53 PM
  • Hi Ravi,

    You can create .net applications to achieve your requirement.

    - You can create console application and schedule it through task scheduler.

    - You can create windows service that will be installed as service components and will run after time interval.

    - You can create SSIS package as mentioned by David.

    Please try to avoid unsupported way.

    Hope this helps!

    Thanks!

    • Marked as answer by Ravi MRC Wednesday, September 11, 2013 6:03 AM
    Tuesday, September 10, 2013 4:28 PM

All replies

  • Hi,

    Firstly, would recommend not to update CRM using SQL. You can find the reasons here http://community.dynamics.com/crm/b/mileyja/archive/2013/09/06/solid-reason-39-s-not-to-do-direct-database-t-sql-operations-on-dynamics-crm-database-from-the-pros.aspx

    Instead of the SQL Job you can write a simple .Net app using CRM web services to update the desired opportunities. This way all your plugins will also be invoked as intended. IT is worth the time you spend in building an app like this as it saves a lot of unwanted trouble.


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    Tuesday, September 10, 2013 2:14 PM
  • Thanks for reply Mamatha. I know its not recommended to update CRM using SQL. But what is the other way to execute this update once in a day. And my SQL job is not specific to opportunities. It will also check Quotes. So how to achieve this using web application or workflow?

    I need to execute it once in a day and based on condition it will get all quotes and opportunities and update status on those records.

    Tuesday, September 10, 2013 2:42 PM
  • Ravi,

    Build a console application that checks the conditions & performs the desired operations. You can then schedule this console application using windows scheduler.

    Here is a walkthrough to build a console app for CRM.


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Marked as answer by Ravi MRC Wednesday, September 11, 2013 6:03 AM
    Tuesday, September 10, 2013 2:53 PM
  • For CRM 4.0 you can refer this http://msdn.microsoft.com/en-us/library/cc151016

    hope this helps!


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    Tuesday, September 10, 2013 2:56 PM
  • The way I'd do this is to create an SSIS package that updates CRM data, either directly via the CRM web services, or via a 3rd party connector (e.g. from www.kingswaysoft.com or  www.cozyroc.com ) - each of these are supported ways to update CRM data, and would cause any plugins to fire. SSIS packages can be scheduled via a SqlAgent job


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

    Tuesday, September 10, 2013 3:46 PM
    Moderator
  • Hi Ravi,

    You can create .net applications to achieve your requirement.

    - You can create console application and schedule it through task scheduler.

    - You can create windows service that will be installed as service components and will run after time interval.

    - You can create SSIS package as mentioned by David.

    Please try to avoid unsupported way.

    Hope this helps!

    Thanks!

    • Marked as answer by Ravi MRC Wednesday, September 11, 2013 6:03 AM
    Tuesday, September 10, 2013 4:28 PM
  • Thanks for the reply all.

    I will do this using console application and definitely it will work.

    Thanks,

    Ravi

    Wednesday, September 11, 2013 6:04 AM