How to get the transactions of stock item, programmatically?

Hi All,

I have an inactive stock item that have not been use for so long (>2 years) and the known transactions has already been archived. My customer would like to remove it from the system. But we encounter this error as attached. So I attempt to delete it programmatically but receive the same error.

How can I get all of the transactions related to this stock item and delete it programmatically?

  • 0

    It's not so much transactions stopping you from that screenshot but quantity of stock in stock. If that stock is removed fully such as by writing it all off, then try deleting the stock item. If that still fails Sage have provided a script to search for the item in the database which you can access here:

  • 0 in reply to Stu Mc

    Hi Stu, thank you for the reply. I have read the resolution and it says to "take appropriate action in Sage 200". That means I will have to get the transaction and let customer do action on it.

    What if I force delete these transaction using SQL script, then I should be able to delete the stock item, correct?

  • 0 in reply to murni

    Hi, the quantity in stock should really be removed from the front end in Sage 200 using the write off stock or Stock take options, as this will handle the database entries. Looking at this from a database point of view there's a number of tables which would need to be cleansed, I can't offer any advice in that respect due to the scope of tables you'd need to consider checking and cleansing.