Skip to main content
Solved

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


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

Best answer by Samvel Petrosov

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();
        }
    }
}

 

 

View original
Did this topic help you find an answer to your question?

2 replies

Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+3

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();
        }
    }
}

 

 


  • Author
  • Jr Varsity II
  • 9 replies
  • January 25, 2021

Thanks Samvel.  

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

 

Thank you.

 

Mark 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings