Solved

How to retrieve a Vendor or Customer record that was previously deleted

  • 12 September 2023
  • 3 replies
  • 147 views

Userlevel 6
Badge +3

Friends, I’ve posted this question before, but unfortunately, the solutions to the first question are not an option

I am trying to extend a customer to a vendor or a vendor to a customer programmatically.  

I want to get my application certified for the marketplace.  However, SQL Views are forbidden.  SO, my current solution will prevent me from getting a certification.

Here is the issue.  There does not seem to be a way within C# and the available DACs to retrieve a deleted customer or vendor record. 

If I try to extend a customer to be a vendor programmatically, when I add the vendor account, it errors because Acumatica sees it as a duplicate.

I need to be able to 

  1. determine if a vendor account is in the db with a DeletedDatabaseRecord = 1
  2. if it is there and of a deleted status, change it to no longer deleted.

If I cannot find a way to extend a customer to a previously deleted vendor without using SQL Views, I kind of screwed.

icon

Best answer by Dmitrii Naumov 12 September 2023, 20:40

View original

3 replies

Userlevel 6
Badge +3

@Dmitrii Naumov One followup...if I find it WAS previously deleted, do you know of a trick to change the flag back to not deleted?

Userlevel 6
Badge +3

@Dmitrii Naumov THANK YOU!

Userlevel 7
Badge +5

You can use PXReadDeletedScope to check if the record exists and has previously been deleted

using (new PXReadDeletedScope()) // to prevent duplicate with deleted business account (DeletedDatabaseRecord = 1)
{
bAccount = PXSelectReadonly<BAccountR,
Where<BAccountR.acctCD, Equal<Required<BAccountR.acctCD>>>>
.Select(this, currentCD);
}

 

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