Skip to main content
Solved

Add SO Allocation with PUT Request on SO Creation

  • Aug 29, 2022 7:51 PM UTC
  • 8 replies
  • 245 views
  • Translate All

Yuri Karpenko
Captain II
Forum|alt.badge.img+7

Does anyone know of a way to use a single Rest API PUT request to both, create an SO, and allocate serialized items to the lines?

I have a call structured like this:

{
"CustomerID": {"value": "C000517"},
"Date": {"value": "2022-08-28T00:00:00"},
"Description": {"value": "Postman Test"},
"Details": [
{
"DiscountAmount": {"value": 10.00},
"ExtendedPrice": {"value": 2000.00},
"FreeItem": {"value": false},
"InventoryID": {"value": "TestItem"},
"OrderQty": {"value": 1.00},
"UnitPrice": {"value": 2000.00},
"UOM": {"value": "EA"},
"WarehouseID": {"value": "MAIN"},
"Allocations": [
{
"SplitLineNbr": {"value": "2"},
"Allocated": {
"value": true
},
"AllocWarehouseID": {
"value": "MAIN"
},
"InventoryID": {
"value": "TestItem"
},
"LotSerialNbr": {
"value": "116046"
},
"Qty": {
"value": 1.000000
}
}
]
}
],
"Hold": {"value": true},
"LocationID": {"value": "MAIN"},
"OrderType": {"value": "SO"},
"OrderNbr": {"value": "POSTM001"},
"RequestedOn": {"value": "2022-08-31T00:00:00"}
}

When I run this code, I get an SO with one detail line and 2 allocations: one without a serial number, and another with a serial number.

I tried using

"SplitLineNbr": {"value": 2}

or

"SplitLineNbr": 2

But still get the same result.

Any ideas how to achieve this without a second call to UPDATE the SOOrder?

Thank you!

Best answer by Dmitrii Naumov

I think if you skip "OrderQty": {"value": 1.00}, in your detail row, it’ll not create the empty allocation

View original

8 replies

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7
  • Community Manager
  • Answer
  • Aug 29, 2022 8:19 PM UTC

I think if you skip "OrderQty": {"value": 1.00}, in your detail row, it’ll not create the empty allocation

Translate

Yuri Karpenko
Captain II
Forum|alt.badge.img+7
  • Author
  • Captain II
  • Aug 29, 2022 10:51 PM UTC

@Dmitrii Naumov , that worked. Thank you!

Translate

  • Freshman I
  • Dec 25, 2023 8:49 AM UTC

 @Dmitrii Naumov  Here i posted my Sample Json for SalesOrderDetail.

I have skip the Quantity but it’s still creating extra allocation without serialNo and   two allocation with SerialNo due to which Quantity of item updated from 2 to 3.

[
    {
      "id": "e51a6d25-ad99-ee11-9ba2-00155d00a401",
      "InventoryID": {
        "value": "2815"
      },
      "LineNbr": {
        "value": 1
      },
      "UnitPrice": {
        "value": 7221.45
      },
      "WarehouseID": {
        "value": "HQ"
      },
      "Operation": {
        "value": "U"
      },
      "Allocations": [
        {
          "LotSerialNbr": {
            "value": "128166"
          },
          "id": "cfcc788f-8dfc-4d88-b74c-9cc15528e779",
          "LineNbr": {
            "value": 1
          }
        },
        {
          "LotSerialNbr": {
            "value": "128116"
          },
          "LineNbr": {
            "value": 1
          }
        }
      ]
    }
  ]

Translate

Yuri Karpenko
Captain II
Forum|alt.badge.img+7
  • Author
  • Captain II
  • Dec 25, 2023 6:01 PM UTC

@Rahulbcomm , what I found out was that I had to create lines in one call, get the SOLine and SOLineSplit IDs, and then UPDATE with a serial number.  I wasn’t able to do it in a single call, unfortunately.

Translate

  • Freshman I
  • Dec 26, 2023 5:49 AM UTC

@Yuri Karpenko 

thanks for update,

do you mean that we need make separate update call for each allocation line?

if  yes can you please help me to built URL for it.

Translate

Yuri Karpenko
Captain II
Forum|alt.badge.img+7
  • Author
  • Captain II
  • Dec 26, 2023 6:22 PM UTC

@Rahulbcomm , your URL would be:

https://company.acumatica.com/entity/Default/20.200.001/SalesOrder?$expand=Details,Details/Allocations

And your body would be:

{
"id": "764e3516-4f71-ed11-8193-1289eaf13cab",
"Details": [

{
"id": "7c4e3516-4f71-ed11-8193-1289eaf13baz",
"Allocations": [

{
"id": "88396a89-712f-42a6-be26-bf1bc24377dd",
"Allocated":
{
"value": true
},
"LotSerialNbr":
{
"value": "8276347"
}
}
],
"WarehouseID":
{
"value": "MAIN"
}
}
]
}

I do it for each line / serial number separately. But you might be able to do so in a single call for all of the lines that must be allocated.

Translate

  • Freshman I
  • Dec 27, 2023 9:42 AM UTC

@Yuri Karpenko  

Does it not works for you in a single call of sales order update? I am trying to update whole salesorder with  all the salesorderdetails and allocation belings to it.

Translate

Yuri Karpenko
Captain II
Forum|alt.badge.img+7
  • Author
  • Captain II
  • Dec 27, 2023 5:31 PM UTC

@Rahulbcomm , it should. My set up is different where it’s easier for me to do multiple calls, but try with a single call, and it should work for you en masse.

Translate