Solved

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


Userlevel 7
Badge +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;
}

 

icon

Best answer by aaghaei 7 May 2022, 10:31

View original

2 replies

Userlevel 7
Badge

Thank you for sharing this update @aaghaei !

Userlevel 7
Badge +9

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

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