Solved

Event.RowSelected - Determining New vs. Existing row

  • 22 June 2022
  • 4 replies
  • 445 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.?

icon

Best answer by MoulaliShaik79 22 June 2022, 16:14

View original

4 replies

Userlevel 7
Badge +5

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

Userlevel 7
Badge +17

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
}

 

Userlevel 4
Badge +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.

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

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