Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

D365FnO On-Pram integration with third party application (Inhouse solution) database.

(0) ShareShare
ReportReport
Posted on by 32

Hi experts

I am going to work on integration. I needs your guidance to start my integration development.

Requirement: Some master data want to share with third party app on the base of master data sales orders / purchase orders happens on third party application and third party application wants to pushed these orders details to D365FnO On-Pram version.

we needs to create sales-order/ purchase-orders in D365FnO On-Pram version.

Please some one guide which integration approch is best it will be helpfull if you share with me any example link.

Please advice.

  • Shakoor Taj Profile Picture
    Shakoor Taj 32 on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Thank you, Let me check and get back to you.

  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    'var' isn't a type. It's just a way of leaving the system to decide which type it is, based on what it on the right side. This may be the source of your problem; use a specific method for the given type, e.g. GetString().

    More robust frameworks can handle it for you. I've used Dapper, LINQ to SQL and Entity Framework, for instance, but there are surely many more.

  • Shakoor Taj Profile Picture
    Shakoor Taj 32 on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Thank you, Martin Drab, for your response.

    I have checked the details of the exception in the debug window and have not found any other errors apart from the one mentioned in the screenshot above. One thing to note is that the external database's customers table has varchar data types for fields such as custcode, custname, shortname, and city, but I am receiving values in a var type variable.

    Can you suggest if this could be an issue?

    Could you also share a link or example for a strongly-typed API.?

    My code compiles successfully with ExecuteNonQueryAsync() without any parameters. I have also tried using ExecuteNonQuery() with the same result.

    Any suggestion. 

  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Look at details of the exception. All I can say from your screenshot is that you have an invalid cast somewhere. For example, is CustCode a text field?

    You may prevent this kind of bugs by using a strongly-typed API instead of the old SqlCommand.

    It's strange if your code compiles at all, because ExecuteNonQueryAsync() requires a parameter and you didn't provide any. It's not a correct way of an asynchronous call anyway; rather use ExecuteNonQuery() instead.

    By the way, there is no point in calling Dispose() on success, on error and then in the 'finally' block, because the last one covers the other two. And you can simplify it with the 'using' statement.,

  • Shakoor Taj Profile Picture
    Shakoor Taj 32 on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Hi experts,

    I am connecting the external Database in D365FO using SQLClient and Select Customers after selection I am updating the City of the Customers but my Update query is not working below is my Code:

    using System.Data.SqlClient;
    class RunnableClass2
    {
        public static void main(Args _args)
        {
            Counter     counter = 0;
    
            SqlConnection conn = new SqlConnection("Server=serverIp; Database=dataBaseName; User Id=UsrId; Password=pswd;");
            str sqlL = "SELECT TOP 10 * FROM Customers";
            SqlCommand command = new SqlCommand(sqlL, conn);
            System.Data.SqlClient.SqlDataReader reader;
            System.Data.SqlClient.SqlParameterCollection parameterCollection;
            new InteropPermission(InteropKind::ClrInterop).assert();
    
            try
            {
                conn.Open();
                try
                {
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        counter  ;
                        var custcode = reader.get_Item("custcode");
                        var custname = reader.get_Item("custname");
                        var shortname = reader.get_Item("shortname");
                        var custCity = reader.get_Item("city");
    
                        if(custcode == '000009')
                        {
                            str update="UPDATE Customers SET city = 'Lahore' WHERE custcode = '000009'";
                            SqlCommand updateCmd = new SqlCommand(update, conn);
                            updateCmd.ExecuteNonQueryAsync();
                        }
    
                        Info(strFmt("%1 - %2 - %3", prdcode,custname,shortname));
                    }
                    Info(strFmt("%1", counter));
                    reader.Dispose();
                }
                catch
                {
                    reader.Dispose();
                }
                catch(Exception::CLRError)
                {
                    reader.Dispose();
                }
                finally
                {
                    conn.Dispose();
                }
            }
            catch
            {
                conn.Dispose();
            }
            catch(Exception::CLRError)
            {
                conn.Dispose();
            }
            command.Dispose();
            CodeAccessPermission::revertAssert();
        }
    
    }

    I have debugged the issue, below is screenshot of debug windows.

    ErrorImage2.jpeg

    Someone help me in this error I am badly stuck at Updating record query.

  • Shakoor Taj Profile Picture
    Shakoor Taj 32 on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Hi Judy,

    Thank you for your response, let me check the link I will get back to you.

  • Suggested answer
    huijij Profile Picture
    huijij 19,811 on at
    RE: D365FnO On-Pram integration with third party application (Inhouse solution) database.

    Hi Abdul,

    Please refer to the discussion for the same topic:

    community.dynamics.com/.../d365fo-integration-with-on-premise-system-file-db

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans