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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

OData integration used to work, now NOT

(1) ShareShare
ReportReport
Posted on by

Hi community,

We have been using Dynamics 365, Business Edition for quite some while, and we rely on an integration to sync our online orders to Dynamics thru OData interface.

Our integration inserts records into "Sales Order" (Page 42), it worked well for quite some time, until January 30th of 2018, we got the following error message when we tried to insert a new record:

Fail to submit. The Sales Header does not exist. Identification fields and values: Document Type = ‘Quote', No.=''

https://foxitpdf.financials.dynamics.com:7048/MS/ODataV4/Company('Foxit%20Software%20%Incorporated)/Sales_Order

We are submitting sales orders and we don't use any quote number, so the error message was very confusing to us. Anyway, we tried to alter the OData query a number of ways, nothing worked. Now we have many orders piling up that can't be automatically sync'ed. We can still input order manually but that's very expensive and slow.

We contacted our service provider, that don't know much about OData integration, and we reported to Microsoft a while ago, but still in the queue.

Can anyone help us? This might force us to stop using Dynamics, which will be a big problem for us. Thanks!

Categories:
  • AndersLarsen Profile Picture
    70 on at

    We will gladly help, but we need some more input does the odata post fails for all records or is it a specific post that fails? And could you provide us with a small sample that can reproduce the error.

    Thanks

  • Community Member Profile Picture
    on at

    Thanks a lot for quick response, Anders. I'll talk to our developer to get a sample set of submission data.

  • Community Member Profile Picture
    on at

    We build a demo page to duplicate the issue. It's at http://sales.foxitsoftware.com/demo/d365_query.php?do=add.

    Here is the PHP codes for the demo:

    <?php

    error_reporting(E_ALL);ini_set('display_errors',        1);

    require 'libs/cls_d365.php';

    $clsD365 = new d365();

    $action = isset($_GET['do']) ? trim($_GET['do']) : 'list';

    $keywords = isset($_GET['keywords']) ? trim($_GET['keywords']):null;

    switch($action){

    case 'add':

           $data = array(

               'Document_Type'=>'Order',

               'Sell_to_Customer_No'=>'C002751',

               'Document_Date'=>'2018-03-12',

               'Posting_Date'=>'2018-03-12',

               'Order_Date'=>'2018-03-12',

               'Tax_Area_Code'=>'NONE',

               'Payment_Method_Code'=>'CC',

               'Salesperson_Code'=>'MAX'

           );

           $data = json_encode($data);

           $r = $clsD365->add('Sales_Order', $data);// post url: foxitpdf.financials.dynamics.com/.../Company('Foxit%20Software%20Incorporated')/Sales_Order

           echo '<pre>';

           echo "<p>POST URL: foxitpdf.financials.dynamics.com/.../Company('Foxit%20Software%20Incorporated')/Sales_Order</p>";

           echo '<h2>Data:</h2>';

           print_r($data);

           echo '<h2>Response:</h2>';

    print_r($r);

    break;

    case 'list':

    $page = isset($_GET['page']) ? (int)$_GET['page']: 1;

    $keywords = isset($_GET['keywords']) ? filter_xss($_GET['keywords']): NULL;

           $r = $clsD365->entitySet('Sales_Order')->OrderBy('Document_Date desc')->Top(2)->OrderBy('Order_Date desc')->Execute();

           echo '<pre>';

           echo "<p>GET URL: foxitpdf.financials.dynamics.com/.../Company('Foxit%20Software%20Incorporated')/Sales_Order</p>";

           echo '<h2>Response:</h2>';

           print_r($r);

           break;

    }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    It seems that it’s calling the service by passing an empty request (object), because Document Type = Quote and No. = blank are the default values.

  • Community Member Profile Picture
    on at

    But we did specify document type as "Order". And it worked before. Here is the current output of the demo:

    POST URL: foxitpdf.financials.dynamics.com/.../Company('Foxit%20Software%20Incorporated')/Sales_Order

    Data:

    {"Document_Type":"Order","Sell_to_Customer_No":"C002751","Document_Date":"2018-03-12","Posting_Date":"2018-03-12","Order_Date":"2018-03-12","Tax_Area_Code":"NONE","Payment_Method_Code":"CC","Salesperson_Code":"MAX"}

    Response:

    Array
    (
        [http_code] => 404
        [response] => {"error":{"code":"Internal_RecordNotFound","message":"The Sales Header does not exist. Identification fields and values: Document Type='Quote',No.=''"}}
    )

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    It seems correct. Are you sure that you don’t have some customizations on Sales Header table now? Maybe on the OnInsert trigger?

  • Community Member Profile Picture
    on at

    We don't think so. Is it even possible to customize Sales Header table or OnInsert trigger, in Dynamics 365 Business Edition (aka Dynamics 365 for Financials)?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Not directly the object but you could have extensions that makes something before or after the insert events. But if you’re sure on that, it’s very strange. This is the typical error thrown when you try to insert a Sales Header record without passing Document Type and Document No.

  • AndersLarsen Profile Picture
    70 on at

    Let me share my progress on this issue

    I could reproduce the reported issue and will take a closer look at it this week.

    While I am looking into this reported issue I will strongly recommend that You and Your partner take a look at our static API stack please see

    docs.microsoft.com/.../fin-graph

    This endpoint will support WEB service access key

    api.financials.dynamics.com/.../companies

    and here is an example of the Salesorders

    api.financials.dynamics.com/.../salesOrders

    Thanks

    Anders

  • Community Member Profile Picture
    on at

    We're also experiencing pretty much the same problem on an onprem Nav 2018; however with SalesInvoices.

    POST request: http://app09:7048/DynamicsNAV110/OData/SalesInvoice?Company=TEST%20ITS%20Customized,%20LLC

    Payload: {"Document_Type":"Invoice","No":"INV40115","Sell_to_Customer_No":"IKCA0001","Payment_Terms_Code":"DUR","Currency_Code":null,"Salesperson_Code":"","Tax_Liable":true,"Tax_Area_Code":"S-DALTX"}
    Request completed: BadRequest
    <?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="schemas.microsoft.com/.../metadata"><m:code /><m:message xml:lang="en-US">The Sales Header does not exist. Identification fields and values: Document Type='Quote',No.=''</m:message></m:error>

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans