Skip to main content
Solved

Class returns null but inside the class until exiting, has value


aaghaei
Captain II
Forum|alt.badge.img+9

Hello Gang,

I have a class that I call it many times. in some case it returns null when I know it should return value. I know that because until the point “approval” it is returning the result, it has value but when its result assigned to a variable “approvalBase” becomes null. Can someone advise why?

 

protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var document = e.Row as APInvoice;

if (document == null) return;

// Do stuff here
EPApproval approvalBase = GetApproval(Base, (Guid)document.NoteID, null, CustomApproved, FirstItem, OwnerOnly, ContactID, null);
// Do Stuff here
}



public static EPApproval GetApproval(PXGraph Base, Guid RefNoteID, Guid? NoteID, string Status, string LookupRange, string Assignee, int? OwnerID, int? WorkgroupID)
{
    // Do stuff here

    return approval;
}

 

Best answer by aaghaei

UPDATE: Figured it out. One of the return conditions was not met right before return

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

2 replies

aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • Answer
  • May 7, 2022

UPDATE: Figured it out. One of the return conditions was not met right before return


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2642 replies
  • May 8, 2022

Thank you for sharing this update @aaghaei !


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