Solved

How to Delete a Leger (screen 201500) using Web Services?

  • 25 January 2021
  • 2 replies
  • 61 views

Userlevel 2

Hi, 

I followed this example https://help-2018r1.acumatica.com/(W(2))/Wiki/ShowWiki.aspx?pageid=d806636f-3cb8-4fd6-bc1e-fef9cdf9683d

to delete an item. It works on Stock and Non-StockItem but it does not work on a Ledger. 

Instead of passing the line below to delete a StockItem

    string stockItem = rs.Delete("StockItem", inventoryID); 
    
I tried 

    string msg = rs.Delete("Ledger", "0915ACT");

but it does not work.

I have tried endpoints 6.00.001, 17.200.001, 18.200.001 and 20.200.001 and all of them failed.

Using EndPoint 20.200.001 fails to login using the same code.

The ledger screen is  localhost/Main?ScreenId=GL201500&LedgerCD=0915ACT

 

Is it possible to delete a Ledger through the Web Service?  The problem is we have many ledgers we setup and we want to programmatically delete them.    We would also like to use the same code to do batch cleans of items we no longer want instead of manually deleting items.

 

Thanks in Advance

 

Mark

icon

Best answer by Samvel Petrosov 25 January 2021, 22:56

View original

2 replies

Userlevel 2

Thanks Samvel.  

After following your instructions to extend the End Points, I was able to delete Ledgers via REST.

 

Thank you.

 

Mark 

Userlevel 4
Badge +1

Hi Mark,

 

First, you need to extend the Default endpoint and add the Ledger there. By default the Default endpoint for 18.200.001 doesn’t contain the Ledger entity. The 20.200.001 contains it but it is not accessable via SOAP.

 

Then you can simply do the delete operation with SOAP or REST like below:

static void Main(string[] args)
{
DeleteLedger("Test");

}
public static void DeleteLedger(string ledger)
{
using (var soapClient = new DefaultSoapClient())
{
soapClient.Login(__username, __password, __tenant, __branch, __locale);
try
{
Ledger l = new Ledger
{
LedgerID = new StringSearch { Condition = StringCondition.Equal, Value = ledger }
};
soapClient.Delete(l);
}
finally
{
soapClient.Logout();
}
}
}

 

 

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