Skip to main content

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;
}

 

Thank you for sharing this update @aaghaei !


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


Reply