Skip to main content
Solved

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

  • September 21, 2023
  • 4 replies
  • 86 views

Atiq
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 38 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()? 
 

 

Best answer by Atiq

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

Thank You

          

View original
Did this topic help you find an answer to your question?

4 replies

Kyle Vanderstoep
Jr Varsity III
Forum|alt.badge.img+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


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 25, 2023

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


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2750 replies
  • October 30, 2023

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


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • Answer
  • October 31, 2023

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

Thank You

          


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