Many times while working in ITSM integration/customization we have requirements to zip all the attachments added to an incident or change or to any of the application request. BMC OOTB do not provide any mechanism to perform this however there is a functionality that zips all the attachments that comes via email in the RBE section of ITSM.
This blog explains how to extend that functionality and use the same plugin to work the scenario we intend to achieve.
To do this POC I will use Change request ID and try to zip all the attachments added to the work info of that change till that time to one zip file.
To use the Plugin we have to understand how this plugin takes input and how it gives output.
As it is meant to work with emails it work with 3 forms basically
- AR System Email Messages
- AR System Email Attachments
- AR System Email Association
So when an attachment is received via an email the GUID is generated on the AR System Email Messages from and as one email can contain many attachments one-> many relation is established between AR System Email Messages and AR System Email Attachments. AR System Email Attachments is the form which stores the attachments.The relation is maintained between these 2 forms by using the third from AR System Email Association.
Below is just an illustration of how the records are related
There are few more parameters that is there in the code, I will show you in the filter itself.
Below is the snip from the OOTB filter, how the plugin is called.
So now I will explain how this can be achieved.
Basically we have to get the attachments from each of the work log by doing a table looping set the attachments to temp field and push the attachment to the required forms with the necessary relationship (GUID and required values.)
- Before pushing the attachment we have to find out the attachment name by trimming the attachment field.
- We have a field that holds the change number and we will have to generate a GUID for each request we want to zip attachments each time.
- A filter need to be created that must run prior to all of the rest filters to generate the GUID for change request (which will be used as Email GUID).
Inside the guide
The first filter clears the temp attachment fields (I have created 3 temp attachment fields assuming at max 3 attachments can be added to a work info)
We have to create similar filter for 3 attachments.
And lastly we have to call the plugin to generate the zip file in the initial filter where we called the guide .
The zip file is stored to a new attachment field called as consolidated in this case.
Please bear in mind depending on the frequency of using this, you may like to delete the created records as part of this.
P.S: There are other ways to do by calling an external program to zip the attachments as well.
If you get error while executing the plugin please refer: https://communities.bmc.com/docs/DOC-86675
Hope this helps.