Skip to main content
Solved

Add SO Allocation with PUT Request on SO Creation


Yuri Karpenko
Captain II
Forum|alt.badge.img+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!

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
Did this topic help you find an answer to your question?

8 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 652 replies
  • Answer
  • August 29, 2022

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


Yuri Karpenko
Captain II
Forum|alt.badge.img+6
  • Author
  • Captain II
  • 379 replies
  • August 29, 2022

@Dmitrii Naumov , that worked. Thank you!


  • Freshman I
  • 3 replies
  • December 25, 2023

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


Yuri Karpenko
Captain II
Forum|alt.badge.img+6
  • Author
  • Captain II
  • 379 replies
  • December 25, 2023

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


  • Freshman I
  • 3 replies
  • December 26, 2023

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


Yuri Karpenko
Captain II
Forum|alt.badge.img+6
  • Author
  • Captain II
  • 379 replies
  • December 26, 2023

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


  • Freshman I
  • 3 replies
  • December 27, 2023

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


Yuri Karpenko
Captain II
Forum|alt.badge.img+6
  • Author
  • Captain II
  • 379 replies
  • December 27, 2023

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings