Search code examples
acumatica

How to delete a canceled Service Contract in Acumatica


I have a request from a client to delete all “Canceled” Service Contracts

I tried adding a delete button to the Service Contracts GI. This resulted with: Error: The record cannot be deleted.

Different approach: I tested using a SQL DELETE in my local Acumatica instance database to bulk delete all existing Service Contracts that have a status of “Canceled”.

              DELETE FROM [FSServiceContract] WHERE Status = 'X'

This appears to have deleted all the Service Contracts that have a Status of “Canceled”, which is what the customer wants. Note: This SQL approach does bypass business rules in this module.

Question: Is there a better (preferred) approach to deleting Service Contracts that have a Status of “Canceled”?

My customer requests:

Bulk delete all of the Service Contracts that have a status of “Canceled”. Give them the ability to delete Service Contracts that have a status of “Canceled” on their own. Thank you in advance.

Ken Severud


Solution

  • You would need to implement a whole functionality to remove child records like the schedules associated to the contract, clean the reference to the service orders/appointment created, etc, just to mention a few.

    Have you thought about making the cancelled contracts not visible? For example, for the Service Contract screen you would need to override the ServiceContractSelected view to add a condition to check the status != Cancelled, so, when navigating, those contracts will not be visible.