web
You’re offline. This is a read only version of the page.
close
  • Add order error details message in RetailTransactionsAuditable data entity

    We use the Commerce (CSU) OData API to send orders from a home-made website in D365. Sometimes, the "Checkout" API request ends with success (HTTP 200) but the order is not created because of some advanced checks (for example: the product can not be sold in a specific country).

    To detect these cases, we are sending requests on the RetailTransactionsAuditable data entity to detect which retail transaction is in error (the retrail transaction is created by 2 scheduled batch jobs: the job "P-0001" to create the retail transaction, and another job to synchronize all retail transactions in automatic).

    If the value of the field AsynchronousOrderStatus is "Failed" then it means the sales order is in an error state. In this case, there is a very precise error message in the "Retail and Commerce" > "Inquiries and reports" > "Online store transactions" page. But this message is not accessible using OData requests. This is a problem for us because if the sales order contains 200 lines, we can't tell the customer which one failed.


    So the idea is: add the "order error details" text value visible in the UI in a new field in the "RetailTransactionsAuditable" data entity.


    See https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/481393/get-retail-transaction-error-message-in-odata

  • Add a maximum retry for retail transaction to sales order synchronization

    It would be nice to set a maximum retry on the "RetailSyncOrdersSchedulerJob". We have some "Failed" retail transactions that are retried every X minutes for months, it's useless and I guess it takes some resources for nothing.


    What would be nice:

    • -1 / blank : no limit
    • 0: no retry. It would allow people to disable the retry which can be useful for some people. See this post: https://community.dynamics.com/forums/thread/details/?threadid=2debcd23-b511-ee11-8f6d-000d3a5474a4
    • x: X retries



  • Give unit price with discount when quantity is greater than one (CalculateSalesDocument API endpoint)

    Context: We use the Commerce (CSU) OData API to get prices and send orders in D365 from a home-made website.


    We are calling API endpoint "CalculateSalesDocument" to get prices for products. When there is a discount, we would like to get the discounted unit price to display it, even if the quantity is greater than 1.


    Example: my product price is 3.27€, with a 15% discount. My discounted unit price is 2.78€.


    When I call the API for quantity 1, no problem, I use "ExtendedPrice" to get the discounted unit price. But when quantity is greater than 1, I can't get the "2.78" value. It's not in CalculateSalesDocument endpoint response. Would it be possible to add it? It's very important value IMO.


    POST xxxx/Commerce/CalculateSalesDocument
    Content-Type: application/json
    {
      "salesDocument": {
        "Id": "CalculateSalesDocument",
        "CustomerId": "CS000003",
        "CartLines": [
          {
            "ProductId": 5637197959,
            "Quantity": 1,
            "UnitOfMeasureSymbol": "Pcs"
          }
        ]
      }
    }


    Response:

    {
     "@odata.context": "...",
     "CartLines": [
      {
       "Quantity": 1,
       "Price": 3.27,
       "ExtendedPrice": 2.78,
       "TotalAmount": 2.78,
       "NetAmountWithoutTax": 2.78,
       "DiscountAmount": 0.49,
       "LineDiscount": 0.49,
       "LinePercentageDiscount": 15.000000000000000000000000,
       "PriceLines": [
        // ...
        {
         "RecordId": 5652434827,
         "Value": 3.27,
         "PriceMethod": "Fixed"
        }
       ],
       "DiscountLines": [
        {
         "EffectiveAmount": 0.49,
         "EffectivePercentage": 14.98,
         "Percentage": 15.000000000000000000000000
         // ...
        }
       ]
       // ...
      }
     ]
     // ...
    }


    When I change quantity to 2, I can't find "2.78" anywhere in the response.

    {
      "@odata.context": "...",
      "CartLines": [
        {
          "Quantity": 2,
          "Price": 3.27,
          "ExtendedPrice": 5.56,
          "TotalAmount": 5.56,
          "NetAmountWithoutTax": 5.56,
          "DiscountAmount": 0.98,
          "LineDiscount": 0.98,
          "LinePercentageDiscount": 15.000000000000000000000000,
          "PriceLines": [
            // ...
            {
              "RecordId": 5652434827,
              "Value": 3.27,
              "PriceMethod": "Fixed"
            }
          ],
          "DiscountLines": [
            {
              "EffectiveAmount": 0.98,
              "EffectivePercentage": 14.98,
              "Percentage": 15.000000000000000000000000
              // ...
            }
          ]
          // ...
        }
      ]
      // ...
    }


    Having "2.78" value in a new field "DiscountedUnitPrice" would be great.