A client asked me to set up Maximo to automatically export work order data in CSV format and send it out via email. Initially, I suggested using the scheduled report function. We can build a simple BIRT report which has one data table. It can be scheduled to run automatically and send out an email with the data attached in Excel format. The user will simply have to open the file and save it in CSV format.
The solution was not accepted due to two reasons:
- It involves some manual intervention.
- BIRT Excel format has a limitation of 10,000 rows. If there are more rows, the data is split into multiple worksheets.
To address this requirement, I wrote an automation script that does two things:
- First, it fetches the MboSet and generates the CSV content using the csv library.
- Send an email with the CSV file attached.
Below is the simplified version as an example. It works with the OOTB Maximo demo instance. Notice that the csv python library I used was included in Maximo out-of-the-box but it is not available to autoscript by default. Thus, we have to append the Lib folder to the library path at line 7.
I created it as a script without a launch point:
To confirm that it works, I call the script by accessing this URL from the browser:
Once confirmed working, I created a cron task to run the script on a schedule. We can also modify this script to address some simple file-based integration requirements by changing the delivery method to SFTP or HTTP POST.
Update: We can also use Apache POI library (included in Maximo OOTB) to export data in Excel format and send as email attachments
0 Comments
1 Pingback