Skip to main content
Answer

Event.RowSelected - Determining New vs. Existing row

  • June 22, 2022
  • 4 replies
  • 641 views

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.

4 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • June 22, 2022

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


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • June 22, 2022

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
}

 


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.


  • Author
  • Freshman II
  • June 22, 2022

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