Skip to main content
Solved

Event.RowSelected - Determining New vs. Existing row

  • Jun 22, 2022 1:51 PM UTC
  • 4 replies
  • 718 views
  • Translate All

Hi,

On event handlers, like for example RowSelected, apart from doing a simple check like if RefNbr equals the defaulting value “<NEW>” or something like that. is there a standard / correct way to check if the row is new or if it’s an existing row being selected for different classes like ARInvoice, ARTran, APInvoice, APTran, Batch, GLTran, etc.?

Best answer by MoulaliShaik79

Hi @rualdventer64 

 

Could you please use the below line in RowSelected Event Handler.

 bool available = (e.Cache.GetStatus(row) == PXEntryStatus.Inserted);

if the result is “True” means existed record.

please give a trial with a new record also for cross-checking.

Hope this helps you.

 

Thanks,

Moulali Shaik.

View original

4 replies

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

You have PXCache.GetStatus(row) that shows you whether a record is inserted or updated (or not changed)

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Jun 22, 2022 2:13 PM UTC

Hi @rualdventer64  In addition to Dmitrii's comment, here is the code sample for your reference.

 

Code Sample:

   if (Base.Document.Cache.GetStatus((object)Base.Document.Current) == PXEntryStatus.Inserted)
{
//NEW ROW
}
else
{
//OLD ROW
}

 

Translate

Forum|alt.badge.img+1

Hi @rualdventer64 

 

Could you please use the below line in RowSelected Event Handler.

 bool available = (e.Cache.GetStatus(row) == PXEntryStatus.Inserted);

if the result is “True” means existed record.

please give a trial with a new record also for cross-checking.

Hope this helps you.

 

Thanks,

Moulali Shaik.

Translate

  • Author
  • Freshman II
  • Jun 22, 2022 2:27 PM UTC

Thanks for the examples guys, really appreciate it, I’ll try all of them and give an update.

Translate