Solved

Is it Possible to Replicate "The return quantity exceeds the quantity available for return for the related invoice line" On SOline Qty Field?

  • 21 September 2023
  • 4 replies
  • 49 views

Userlevel 2
Badge
  • Jr Varsity II
  • 24 replies

Hi,

 For RC Orders in Sales order Screen, Basically when we bring the values from “Invoice Filter” Action it brings inventory items with invoice Nbrs in SOLine. And it Sometimes  displays errror message on Qty feild “The return quantity exceeds the quantity available for return for the related invoice line AR010261, FOODCHIP36. Decrease the quantity in the current line, or in the corresponding line of another return document or documents AR010308, AR010316 that exist for the invoice line”,   i Have also created another Action button in the grid,that works excatly like  invoice filter action, i can bring the inventory items with invoice id to the SOLine grid, But i cannot display the error message that is being displayed with “Add Invoice Action”   , Upon doing some R&D, i came to know that the error message is being displayed from “MemoCheck()” Methrod of “SOOrderItemAvailabilityExtension” graph,  Hear is the sample code 

        public virtual bool MemoCheck(SOLine line, bool persisting)
        {
            if (line.Operation == SOOperation.Issue)
                return true;

            var result = MemoCheckQty(line);
            if (result.Success != true)
            {
                var documents = result.ReturnRecords?
                    .Select(x => x.DocumentNbr)
                    .Where(nbr => nbr != line.OrderNbr);

                RaiseErrorOn<SOLine.orderQty>(persisting, line, Messages.InvoiceCheck_DecreaseQty,
                    LineCache.GetValueExt<SOLine.invoiceNbr>(line),
                    LineCache.GetValueExt<SOLine.inventoryID>(line),
                    documents == null ? string.Empty : string.Join(", ", documents));
            }

            return result.Success;
        }

But iam not understanding how to implement this code into my Graph,  Is there any Way how to implement this Methord()? 
 

 

icon

Best answer by Atiq 31 October 2023, 12:37

View original

4 replies

Userlevel 3
Badge +1

In the Row Selected event on SOLine, use the following pseudocode

if (some check is true)

      PXUIField.SetError<Dac.fieldToSetTheError>(e.Cache, e.Row, SomeNewValue if needed, Your Error Message);

 

And you will get an error message like you want

Userlevel 2
Badge

Hi Kyle,

            Thanks for the response, but the above code which you mentioned is needed to Externaly display the error message to the paticular feild, but in my case the validations for the quantity feild are linked to 2 or 3 invoices. So in this case iam Implementing a methord MemoCheck() from the base code which throws this type of error, but iam unable to do it

Userlevel 7
Badge

Hi @Atiq were you able to find a solution? Thank you!

Userlevel 2
Badge

Hi @Chris Hackett  I have updated the code in the FeildUpdated event and RowPersisting event and it is working for me  

Thank You

          

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