5 Replies Latest reply on Jul 23, 2018 12:04 PM by MoBattah

    Creating new objects (incidents) from email attachments.

    ian.teasdale@it.ox.ac.uk Apprentice

      I'm not sure if this is even possible, but I'd be keen to know if anyone has attempted this and how they approached it.


      The use case I have is that our out of hours support is provided by a third party organisation and each morning they send us an email with details of the incidents they've dealt with overnight. These details come through as an email attachment, the supplier sends the data in 3 different formats: csv, html and xml . The volumes at the moment are pretty low (a handful of incidents each night), so at the moment these are just being logged manually, however I would really like to automate the process.  I suspect I'll need to set up a dedicated email listener to deal with them which isn't a particularly big issue, but beyond that I'm not sure where to go next so I'm hoping someone has done something similar.

       

      Any suggestions would be very welcome.

       

      Ian

        • 1. Re: Creating new objects (incidents) from email attachments.
          florian1 Expert

          Hi Ian,

           

          your requirement is not really clear to me, can you please be a bit more precise:

          • do you have to iterate through each file (CSV, HTML or XML) and create an Incident for each row? OR
          • do you want to paste the attachment's content into the Incident's details? OR
          • would you just like to create an Incident with attachments for each mail ?

           

          Cheers,

          Florian

          • 2. Re: Creating new objects (incidents) from email attachments.
            ian.teasdale@it.ox.ac.uk Apprentice

            Hi Florian

             

            The email we receive has 3 attachments containing the same information, so I only actually need HEAT to process one of the attachment. The attachment will contain multiple incidents on essentially different lines and I'd need HEAT to log a separate incident for each line in the attachment.

             

            Thanks


            Ian

            • 3. Re: Creating new objects (incidents) from email attachments.
              florian1 Expert

              Okay, so the main difficulty here will be reading the attachment. I don't know if there are straight-forward ways as I'm not yet deep enough into HEAT 2015.

              My first thoughts revolve around the following 3 options:

               

              1) Using a File Listener and the provided XML file as a source:

              The easiest way (in my opinion):

              • let your 3rd party Provider upload the XML document to a specific location HEAT can access
              • Process the XML document using XSL transformations
                •   for each incident found from within the XML document:
                  •   create an incident

               

              2) Using HEAT WebService connection:

              • Create a "processing" business object to store the E-Mails including attachments.
              • Add a XSLT Connection for E-Mail with attachments and try to filter out only XML attachments (I prefer this format - don't know if you can already filter file extensions from within XSLT)
              • create a WebService connection to query the HEAT API:
                • retrieve the processing business object's RecID(s) ("Search()")
                  •   for each bo retrieve the XML attachment InMemory ("ReadAttachment()")
                  •   for each incident found from within the XML document:
                  •   check if you already have the same incident
                    •   if not: create an incident. ("createObject")

               

              3) Using an external program (e.g. in C#):

              a) Either:

              - create a "processing" business object to store the E-Mails including attachments.

              Or

              - access access an inbox directly

              Or

              - save the XML file automatically under a specific place (could be automatically done via SFTP)

               

              b) Create an application:

              • Add FRSHEATIntegration.asmx as a Service Reference
              • Get the XML file from a).
                • for each incident found from within the XML document:
                • check if you already have the same incident
                  • if not: create an incident. ("createObject")
              • 4. Re: Creating new objects (incidents) from email attachments.
                ben.prinsloo1 Apprentice

                For 3(b), if you have a key field that will identify the Incident uniquely, use "UpsertObject". This will update if the object exist, else it will create the object. I wrote some sample code in VS2015 for a recent demo using these operations. It is actually very easy.

                • 5. Re: Creating new objects (incidents) from email attachments.
                  MoBattah Rookie

                  Ben, do you still have that code?