Solved

Cannot create multiple RC from the same invoice via Sales Order REST API

  • 2 August 2022
  • 3 replies
  • 48 views

Scenario:

We want to create returns via REST APIs. We have published a customization package for this. Technically, this is how the customization package works:

  1. Creates a blank RC order
  2. Trigger SalesOrderAddInvoice action to add products from the invoices
  3. Update RC with relevant quantities

The above process works for the first RC.

Any further RC creation from the same invoice throws the below error:

"The return quantity exceeds the quantity available for return for the related invoice line <INVOICE_NBR>. Decrease the quantity in the current line, 
or in the corresponding line of another return document or documents <RETURN_NBR> that exist for the invoice line."

 

This is the similar error we usually see on Acumatica UI when adding the same inventory from an invoice.  However, we can create the RC from the UI by modifying the quantity.

 

Question:

Is there anyway to fix this issue?

 

We are on Acumatica 2022 R1.

 


Regards

icon

Best answer by Dmitrii Naumov 8 August 2022, 15:36

View original

3 replies

Userlevel 6
Badge +1

The actions in which you need to select specific lines from a document do not really work well via REST API. Usually we need to have specific code to handle such situations. 

 

That specific case is not covered in the 22r1 version of Acumatica. However, it is covered in 2022r2 version. 

 

Please check dev release notes (page 22):

http://acumatica-builds.s3.amazonaws.com/builds/preview/22.2/ReleaseNotes/AcumaticaERP_2022R2_Beta_ReleaseNotes_for_Developers.pdf

Thank you, @Dmitrii Naumov

Could you please clarify what specific code you’re referring to? 

 

It’s a crucial feature of our application. Isn’t there any hack or quick fixes to this solution?

We can share the customization code we wrote for this.

Userlevel 6
Badge +1

@voyantcs I’d say the easiest way to implement it is to create a screen with needed parameters and one action and implement all needed logic there. Then you map that screen to an endpoint and use it via API. 

 

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 — 2022  Acumatica, Inc. All rights reserved