web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to retrieve data from On-Premise SQL to Dynamics CRM online

(0) ShareShare
ReportReport
Posted on by 70

Hi guys,

I have a requirement where i need to retrieve data fro On-Premise SQL and insert in CRM online.

How i can achieve this, can anyone help me out in this?

Regards,

Gopinath V.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    prt33k Profile Picture
    6,907 on at

    hi Gopi,

    Which job need to do this operation? A plugin/workflow or a console app/service?

    If you want this to be done via a plugin/workflow then you need to create a  WCF service which exposes you data and then call it from plugin. This service will act as layer and will interact with DB while the plugin will interact with the service.

    Thanks,

    PS

  • Suggested answer
    Community Member Profile Picture
    on at

    Refer this:

    crmbook.powerobjects.com/.../select-a-tool-to-use

  • How to retrieve work hours for a user Profile Picture
    70 on at

    Hi PS,

    I want to use plugin but my CRM is in online how the plugin will try to connect to On-Premise SQL db, i don't think so that if anything let me know.

    Thanks

  • How to retrieve work hours for a user Profile Picture
    70 on at

    Hi Akhtar,

    The link which you provide is a tool whether this will connect my On-Premise db and move the data to CRM online.

  • Suggested answer
    Community Member Profile Picture
    on at
  • Suggested answer
    Community Member Profile Picture
    on at

    Scribe can connect to On Premise DB and CRM Online as well

  • Suggested answer
    prt33k Profile Picture
    6,907 on at

    Hi Gopinath,

    The plugin need to call the Azure hosted web service.

    The Azure hosted web service will in turn call the local SQL Server.

    You can read here for connecting Azure web app with local SQL DB.

    docs.microsoft.com/.../web-sites-hybrid-connection-get-started

    Thanks,

    PS

  • Community Member Profile Picture
    on at

    Hi gopi, 
    I am affraid that you cant achieve that through plugin. I have tried to create plugin in crm online to connect CRM 365 Database. The problem is, you need to register your plugin in "None Isolation Mode". Unfortunately, this mode is not supported for CRM Online. Only "Sandbox" is supported.  CMIIW .

    I would suggest you to use Console Application to accomplish your work. Here is the code i use to connect into CRM Database from console application:

     try
                {
                    using (SqlConnection con = new SqlConnection("Data Source=10.10.123.123; Initial Catalog=MLPT_MSCRM;User Id=admin;Password=admin"))
                    {
                        string sqlQuery = @"SELECT [OpportunityId],[new_PresalesID] FROM [MLPT_MSCRM].[dbo].[Opportunity] where Createdon >= DATEADD(DAY, -1, getdate())";
                        using (SqlCommand cmd = new SqlCommand(sqlQuery, con))
                        {
                            SqlDataAdapter da = new SqlDataAdapter(cmd);
                            da.Fill(dt);
                        }
                        Console.WriteLine("Connection Success !!");
                        logger.Info("Connection Success !!");
                    }
    
    
                    Console.WriteLine("Attempting to get records from Database");
                    logger.Info("Attempting to get records from Database");
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            try
                            {
                                presalesid = dt.Rows[i][1].ToString();
                                serviceid = new Guid(dt.Rows[i][0].ToString());
                                Console.WriteLine("Records Retrieved");
                            }
                        }
                    }
    


  • Suggested answer
    JohnAnonymous Profile Picture
    5,241 on at

    In my view you have a few options:

    1. Use a tool like Scribe (online). They have agents that you can run locally and can connect from the cloud

    2. Use a plugin. But then you need to have an azure webservice that somehow connects to your onpremises SQL DB (using an Azure Function would be a very lightweight option)

    3. Use Microsoft flow (flow.microsoft.com/.../sql-server) in combination with the GateWay (flow.microsoft.com/.../gateway-manage) to connect to you local db.

  • How to retrieve work hours for a user Profile Picture
    70 on at

    Hi Martijn,

    The option 3 i have used it and that can be used for sending records from CRM to SQL.

    It's not from SQL to CRM, you can't retrieve records from SQL to CRM.

    The option 2 for that we need to buy Azure and so that we can access the db right?

    Thanks,

    Gopi

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans