ERP Software Logo

Microsoft Dynamics vendors provide comparisons and opinions to professionals in the ERP/Accounting software selection process

 
 

Columbus Global

Dynamics CRM Sales Invoices to D365 for Financials


    Email | Print

    In this blog we will be highlighting the steps to send sales invoices from Dynamics CRM to Dynamics 365 for Financials.

    Use Plugin in CRM

    Here are the steps:

      1. Download the CRM SDK from Microsoft.
      2. In SDK package, add the “CRMSDKTemplates” into Visual Studio (find the matched one with your VS version).
      3. Create a new CRM Plug-in Library in Visual Studio. 
      4. Create early bound entity classes with the code generation tool (CrmSvcUtil.exe, run it in Command Prompt under this tool’s directory).

    1. Use the early bound entity classes to retrieve the Sales Invoice entity from the LocalPluginContext.

     Create and use Web API in D365 for Financials

    Now you have your Sales Invoice entity from CRM and want to map the related fields in Financials and send those field values to Financials.

    1. Create a Web Service for Sales Invoices in Financials. Make a copy of the Web Service URL and you will need it later. https://yourcompanyname.financials.dynamics.com:7048/MS/ODataV4/Company(' yourcompanyname’)/SalesInvoice
    2. Find out the metadata (data structure formatted in JSON) of the Web Service you just created. What I did is creating a temporary Console Application and adding the service reference. Then I could check the data type of the sales invoice in Visual Studio.
    3. Decide and map the related fields. Create your own class with the same fields in the Plugin code (the class name can be any, but the type and name of those fields you need to map should be exactly the same as what is in the service reference).
    4. Use DataContractJsonSerializer to serialize your created class for sending it to the web service.
    5. Create a web request to the URL of the Web Service using HttpClient class (username is your account user name in Financials and the password is your web service key).                                           
    6. Send the request to the Web Service using POST method.
    7. Then you maybe want to send the Sales Invoice line items. You should repeat Steps 2 to 6 for the line items: creating a line item class, mapping the fields, serializing it and posting it. The only tricky point is the line item URL is based on the header you previously sent. It looks like:https://yourcompanyname.financials.dynamics.com:7048/MS/ODataV4/..

    What’s more tricky is that sometimes the header passed into Financials successfully but the line or lines do not. Then you have to log into Financials and delete the header manually.

    To learn more about Microsoft Dynamics 365 for Financials, contact us at [email protected].

    Ask This Expert a Question / Leave a Comment