Deleting DOCLINKS with Automation Scripting
SachBalagopalan 270002XVDD Visits (16347)
Contributors: Steve Hauptman, Ted Lyons, Mike Sielian, John Cook, Melody Bienfang
This post describes a technical solution that gives clients the flexibility to delete attached documents (DOCLINKS) seamlessly and with ease. By leveraging existing functionality in Maximo namely Escalations and Automation Scripting, you can purge attached documents from the location where the document physically lives. A selection criteria should be defined in an Escalation (e.g. STATUS = 'CLOSED') along with an Action which invokes a Python script (described in this post) that will physically delete the document from the server.
The Python script provided in this post is generic and can be applied to any object (Workorder, Incident, SR etc). Although we recommend this script be used with an Escalation and an Action launch point, it can be used with other launch points as well. In addition to deleting the document from the server the script will also cleanup the entries in the Doclinks and other related tables. There will be no "orphaned" records lingering after the file is physically deleted. The script addresses direct attachments as well as attachments uploaded via Communication Templates and CommLog.
Finally before we get into the details please note that this solution should not be deployed directly into a production environment before testing and making sure it fits the client's use case. The script does not contain any business rules or any sort of validation. It simply deletes the file and cleans the Doclink table. It is up to the client to decide when to invoke the script by defining the appropriate escalation criteria and frequency.
Defining the Automation Script in the Automation Scripts Application
Launch the Automation Script App and ....
1) Select "Script with Action Launch Point" - you're going to be launching this script from an Action.
2) Give it a name like DOCLINKS or something and note it down because you'll need it when defining the Action in the next step. I used Workorder but you can set the Object to whatever is applicable.
3) Set the fields as defined in the image below.
4) Cut and paste the python code from the "Code" section in blue above
Define an Action in the Actions Application
Go to the Actions app and create a new action like this ...
The Parameter/Attribute has to the be the same name as the Script name created in the step above.
Define the Escalation
Go to the Escalation Application and define an Escalation with the appropriate condition and reference points that fit your use case. Here
This is a pretty powerful solution for those seeking to delete DOCLINK attachments within Maximo. There is no need to deploy any compiled code or bring down the server to take advantage of this solution.