to connect with other database from Dynamics crm 2011 -urgent RRS feed

  • Question

  • Hi,

    I want to fetch some value from other database from Case creation page in dynamics CRM 2011 and set a option type field which of bool type..

    The actual scenario is on the case creation page there a text box when user key in there should be a method which should go and check it in a different database which on other server and on the basis of the result it should set a field on the case creation page..

    Now I am unable to think which process to follow as how to connect with other database using script or have to write plugin and if yes what is the process of creation connection with other data base in plugin Or have to follow some other way...

    please suggest...


    Sunday, September 8, 2013 3:23 AM

All replies

  • Since it's urgent, take a look at this:


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Sunday, September 8, 2013 7:10 AM
  • Hi ,

    Thanks for your reply.. I read the post in that lastly they changed their process to Calling WCF then I want to know if WCF is the solution to connect with other database then is this possible to call that WCF service from Script .... I mean Javascript which is can be written on Form in CRM...

    and 2nd thing if we write Plugin whether we can excess any config file to store the connection string or have to hard code it in the Code.


    Monday, September 9, 2013 4:06 AM
  • Hello Santosh,

    Yes you can call wcf service using JS and for configuration value you can create a custom entity in crm where you can defind you connection string and can read this entity in your plugin or you can pass configuration to your plugin itself at the time of registering it, Check this.

    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Monday, September 9, 2013 8:12 AM
  • Hi,

    Thanks for your reply ..

    last thing I want to choose from creating plugin and using JS of CRM to do this work, which one will be better approach, creating a wcf service and using it in the From JS or creating Plugin without WCF and it need  this action Asynchronous. please suggest me and also give link of how to use JS sdk in CRM .. am new for this.


    Monday, September 9, 2013 9:11 AM
  • Monday, September 9, 2013 9:32 AM
  • Well keeping logic in service side code is always preferable, you can check MS CRM SDK, (download it if you have not done it yet, it has sample code to use JS in MS CRM).

    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Monday, September 9, 2013 9:37 AM
  • Hi,

    I have created the plug in but unable to think how to implement the logic as I have to fire (execute) my code on a control's text change event and on that by taking the value of that control it should go to other database to find the matching value and on that basis set the another control on that page it is of option type.

    That means till now the case is not created so unable to think or can understand the event at the time of registration. or how to execute the plugin code on the Change event of the control on which i need to run that.

    I think, have clearly stated my problem. Now is this possible to do with this Or have to go with some other approach.


    Saturday, September 14, 2013 7:56 AM
  • Hi Santosh,

    The Plugin Fires on particular events like: Create, Update, SetState, Delete etc. As you have mentioned while creating Case user when user changes controls text you want to retrieve some values from external database. The Plugin Won't fire on change event.

    - You can write plugin on Pre/Post Create of case.

    - In Plugin you can check if Target property has modified field then you can proceed and retrieve data from external database and update the case.

    Do you want this in Update case as well when user will update the existing case text control value? In such a case you will have to register the plugin on UPDATE event as well.

    Hope this helps!


    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Saturday, September 14, 2013 10:39 AM
  • Hi,

       The best way to do this on the client side. I suggest using WCF service to fetch data from another database. You can then call WCF service from JQuery / JavaScript on change of text. This way you can perform what you are after. This approach will work for you. Server side code is not the best way to achieve this.


    Saturday, September 14, 2013 10:57 AM
  • Hi ,

    Thanks for your reply.

    As I have to take value of some control and also set some control so I have to use the Javscript of SDK will u please send m e some link for consuming wcf or web service in crm page script coding,


    Sunday, September 15, 2013 3:41 AM
  • Hi,

         Here is few examples for the same.



    Hope this helps.
     Minal Dahiya
    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Sunday, September 15, 2013 10:59 AM
  • Hi Thanks for reply.

    But this about calling the wcf using jquery I want to know to call the wcf on the Form. And whether any option in XRm library to call wcf and have to modify any thing on that.

    and how to write ... As my totally new to this type of developnent please send me some link and tutorial to start.


    Monday, September 16, 2013 8:32 AM
  • Hi,

         You use JavaScript on the form to execute anything on client side. Hence I have given the example for JQuery calling WCF which would be the case for you. Here are some basic examples:



         And for WCF service call follow articles listed above.

    Hope this helps.


    Monday, September 16, 2013 11:20 AM