Solved

Sales Order Create Shipment action


Userlevel 1
Badge

Hello. Im trying to run SalesOrderCreateShipment method right after the sales order is created.

Im sending this (json encoded) array http://joxi.ru/LmGpkVnuwQvRR2 to 

/entity/Default/20.200.001/SalesOrder/SalesOrderCreateShipment

address (just like here) https://help.acumatica.com/(W(8))/Help?ScreenId=ShowWiki&pageid=9a0b1037-c931-4eff-a974-15403d3227a7

but getting the following error

"Error in action invocation: Value cannot be null. Parameter name: key"

here is stack trace https://justpaste.it/52nn1

wats im doing wrong? thanks!

icon

Best answer by Dmitrii Naumov 1 September 2022, 16:35

View original

13 replies

Userlevel 7
Badge +5

Hi! 

The recommended way to create a Shipment from SO through the REST API is actually to send a request to Shipment endpoint instead of executing the CreateShipment action. 

 

Please see an example here:

https://help.acumatica.com/(W(42))/Help?ScreenId=ShowWiki&pageid=ab83de33-505c-476e-b8b8-99f2a98e142c

Userlevel 1
Badge

Hi! 

The recommended way to create a Shipment from SO through the REST API is actually to send a request to Shipment endpoint instead of executing the CreateShipment action. 

 

Please see an example here:

https://help.acumatica.com/(W(42))/Help?ScreenId=ShowWiki&pageid=ab83de33-505c-476e-b8b8-99f2a98e142c

Hello. Thank you for the reply. Im trying to process this request 

  1. {"CustomerID":{"value":"ZPM-C56007"},"Details":{"OrderNbr":{"value":"71064"},"OrderType":{"value":"ZW"},"OrderLineNbr":{"value":1},"Allocations":[{"InventoryID":{"value":"HANDAMMO000035"},"Qty":{"value":"1"},"LocationID":{"value":"MAIN"},"UOM":{"value":"EA"}}]},"LocationID":{"value":"MAIN"},"Operation":{"value":"Issue"},"Packages":{"BoxID":{"value":"LARGE"},"UOM":{"value":"KG"},"Weight":{"value":1}},"WarehouseID":{"value":"DEFAULT"}}

to 

/entity/Default/20.200.001/Shipment?$expand=Details,Details/Allocations,Packages,Packages/PackageContent

but getting

"Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Newtonsoft.Json.Linq.JObject]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Details.OrderNbr', line 1, position 59."

 

Could you please help?

Thanks.

Userlevel 7
Badge +5

Hi @skater4

your JSON is not formatted correctly, you don’t have square brackets [] for the details section.

See how you do it in ‘Allocations’, there you have the correct format.

 

Userlevel 1
Badge

Hi @skater4

your JSON is not formatted correctly, you don’t have square brackets [] for the details section.

See how you do it in ‘Allocations’, there you have the correct format.

 

Now im trying this

"{"CustomerID":{"value":"ZPM-C56007"},"Details":[{"OrderNbr":{"value":"71064"},"OrderType":{"value":"ZW"}}],"LocationID":{"value":"MAIN"},"Operation":{"value":"Issue"},"WarehouseID":{"value":"DEFAULT"},"CreateNewShipmentForEveryOrder":{"value":true}}"

but getting operation error http://joxi.ru/RmzQdXoIYq7nBr

Userlevel 1
Badge

from here https://help.acumatica.com/(W(43))/Help?ScreenId=ShowWiki&pageid=03c70fe4-c9e5-4539-b156-352bef734b2a

Userlevel 7
Badge +5

@skater4 please post the full error message as text. The screenshot is not that useful

Userlevel 1
Badge

@skater4 please post the full error message as text. The screenshot is not that useful

"Operation failed"

"PX.Data.PXInvalidOperationException"

"Exception has been thrown by the target of an invocation."

"System.Reflection.TargetInvocationException"

"Value cannot be null. Parameter name: key"

stack trace https://justpaste.it/2k47a

Userlevel 7
Badge +5

Could you please try to remove CreateNewShipmentForEveryOrder and send it again?

Userlevel 1
Badge

Could you please try to remove CreateNewShipmentForEveryOrder and send it again?

same error, other stack trace

https://justpaste.it/8b0zi

Userlevel 7
Badge +5

@skater4  I’ve just tried myself and it seems to work fine on my side. 

 

Could you please check that your URL looks something like that: 

{{sitename}}/entity/Default/20.200.001/Shipment

and that your request type = PUT

Userlevel 1
Badge

@skater4  I’ve just tried myself and it seems to work fine on my side. 

 

Could you please check that your URL looks something like that: 

{{sitename}}/entity/Default/20.200.001/Shipment

and that your request type = PUT

Ive tried several times, one time i got error that carriers doesnt have boxes, other times just error with no info.

Ive also tried first query again and got 202 status with no response. Any idea?

 

Userlevel 1
Badge

Also if i try to create shipment manually, it returns error

 

Userlevel 7
Badge +5

@skater4 as for the 202 status code, please see below types of responses for executing actions and what they mean:

https://help.acumatica.com/(W(51))/Help?ScreenId=ShowWiki&pageid=91bf9106-062a-47a8-be1f-b48517a54324

 

As for the errors you describe, those are Business Logic errors. E.g. you may not have Boxes configured in the system, or you may not have enough qty of the items on the warehouse, etc.

So, the recommendation here is to make sure you have everything configured properly and try to execute it again afterwards.

 

 

Also I’d recommend trying with ‘SalesDemo’ database first.

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