Solved

Add SO Allocation with PUT Request on SO Creation

  • 29 August 2022
  • 8 replies
  • 132 views

Userlevel 7
Badge +6

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!

icon

Best answer by Dmitrii Naumov 29 August 2022, 22:19

View original

8 replies

Userlevel 7
Badge +5

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

Userlevel 7
Badge +6

@Dmitrii Naumov , that worked. Thank you!

 @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
          }
        }
      ]
    }
  ]

Userlevel 7
Badge +6

@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.

@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.

Userlevel 7
Badge +6

@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.

@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.

Userlevel 7
Badge +6

@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.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved