After upgrade to ESPO 8.2.3 one API Field Validation consistently fails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bpud
    Junior Member
    • Apr 2024
    • 3

    After upgrade to ESPO 8.2.3 one API Field Validation consistently fails

    We have been running EspoCRM with Sales Pack and Advanced Pack. Using the API to push sales orders in from our back office commerce platform, and it has been working great for nearly a year.

    Yesterday it looks like our tech team upgraded to the latest ESPO and upgraded the Sales Pack and Advanced Pack extensions. It does not appear to have generated any errors during the upgrade process, at least not any obvious after looking at logs and reviews from their work.

    The one issue that appears to have risen from this upgrade is when doing an API call to insert a new order, it throws this error now:

    Field validation failure; entityType: SalesOrderItem, field: unitPrice, type: required.

    Here is the array that's being passed to the API that had been working prior to the upgrade, where you will see that unitPrice is there:

    array(13) {
    ["billingContactId"]=>
    string(17) "6625eb6729b7aed7f"
    ["shippingContactId"]=>
    string(17) "6625eb6729b7aed7f"
    ["dateInvoiced"]=>
    string(10) "2024-04-22"
    ["dateOrdered"]=>
    string(10) "2024-04-22"
    ["itemList"]=>
    array(2) {
    [0]=>
    array(6) {
    ["productId"]=>
    string(17) "64dd6d006307a9bf6"
    ["listPrice"]=>
    string(1) "1"
    ["name"]=>
    string(31) "<removed for public post>"
    ["quantity"]=>
    string(1) "1"
    ["amount"]=>
    int(1)
    ["unitPrice"]=>
    string(1) "1"
    }
    [1]=>
    array(6) {
    ["productId"]=>
    string(17) "64dddbbc62551a2bf"
    ["listPrice"]=>
    string(1) "3"
    ["name"]=>
    string(40) "<removed for public post>"
    ["quantity"]=>
    string(1) "1"
    ["amount"]=>
    int(3)
    ["unitPrice"]=>
    string(1) "3"
    }
    }
    ["name"]=>
    string(19) "<removed for public post>"
    ["status"]=>
    string(9) "Completed"
    ["shippingCost"]=>
    string(4) "7.95"
    ["shippingAddressState"]=>
    string(2) "TX"
    ["shippingAddressCity"]=>
    string(11) "<removed for public post>"
    ["shippingAddressPostalCode"]=>
    string(5) "<removed for public post>"
    ["shippingAddressCountry"]=>
    string(2) "US"
    ["shippingAddressStreet"]=>
    string(16) "<removed for public post>"
    }

    Has anyone seen something similar crop up? It is not specific to any one order, it appears to be any order we try to import thru the API and thus-far is only the unitPrice field that fails validation.

    Thank you in advance,

    -BP
  • macistda
    Member
    • Jul 2022
    • 76

    #2
    Did you update from sales pack 1.x to 2.x ?
    Maybe the error relays something like discribed here:
    We use an additional field (currency) within products. That value is calculated (15 % from listprice - annual maintenance) currency. But we have some products that have no maintenance. This field then is NULL. We use the same additional field (currency, field not linked from products) within quote items, where that value from

    Comment

    • bpud
      Junior Member
      • Apr 2024
      • 3

      #3
      We were on an earlier version of 2.x, so it wasn't a 1.x to 2.x. I'm going to run a Chrome DevTools and look at whats posted using the webclient, perhaps we are missing some other field that now works in conjunction with unitPrice that isn't being passed.

      Comment

      • macistda
        Member
        • Jul 2022
        • 76

        #4
        Maybe the "converted"-fields require validation now, too. To try you should set all fields for prices, currency, and the two fields "converted...".
        We sometimes have the same error (without API) in formulas if we copy from an old dataset. But only for the 1st position/item, if we delete this and enter manually again then it's okay. Also the rest of the copied positions/items.

        Comment

        • bpud
          Junior Member
          • Apr 2024
          • 3

          #5
          So it looks like we just needed to include:

          ["unitPriceConverted"]=>
          string(1) "3"
          ["unitPriceCurrency"]=>
          string(3) "USD"

          And now orders post fine through API calls. So if anyone else runs into that, it looks like unitPrice needs these two to validate.

          Comment

          • Kharg
            Senior Member
            • Jun 2021
            • 410

            #6
            It happens with currency fields, I had to disable validation for these fields, I don’t think it’s a bug, just a strict validation requirement.

            Comment

            • macistda
              Member
              • Jul 2022
              • 76

              #7
              Yes, it's not a bug, it's a "new" feature (added some validations)
              I had to correct at different formulas to fill in converted and currency in the past.​

              Comment

              Working...