Skip to main content
Answer

PXResult.Record registering as null despite values in the PXResult

  • September 14, 2023
  • 2 replies
  • 92 views

martinxfe
Jr Varsity II
Forum|alt.badge.img

I’m working on the following process graph:

When debugging, the prepay.Record registers as null, despite the prepay having a single complete record of the invPrepayList resultset. 

Visual studio does not flag the application of the result.record.fields to the new rec fields as an error. It simply runs as though the record is null. 

Can anyone tell me what I am missing?

Best answer by Keith Richardson

Since you are using a single object being returned, you can cast prepay right to APInvoice
 

foreach(APInvoice prepay in invPrepayList)

If you did a join, you would still use var, then get the item type separately, into multiple for each type. Here is an example for getting the APInvoice out of it:

foreach(var prepay in invPrepayList)
{
APInvoice invoice = prepay.GetItem<APInvoice>();

//now you can use invoice.RefNbr
}

 

2 replies

Keith Richardson
Semi-Pro I
Forum|alt.badge.img+2

Since you are using a single object being returned, you can cast prepay right to APInvoice
 

foreach(APInvoice prepay in invPrepayList)

If you did a join, you would still use var, then get the item type separately, into multiple for each type. Here is an example for getting the APInvoice out of it:

foreach(var prepay in invPrepayList)
{
APInvoice invoice = prepay.GetItem<APInvoice>();

//now you can use invoice.RefNbr
}

 


martinxfe
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • September 14, 2023

Thank you, Keith. That did it.