Messaging Module

From Zymonic

This module handles the process of incoming messages, and how to set processes up to receive incoming messages.

The process must have the following extra definition parts as a minimum:

    <IncomingMessage>
      <Transition>
        <ZName>svz_transition_ticket_save</ZName>
      </Transition>
      <MessagePartMap>
        <MessagePart>from</MessagePart>
        <Field>svz_f_ticketrequester_lf</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>subject</MessagePart>
        <Field>svz_f_ticketsubject</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>attachments</MessagePart>
        <Field>svz_f_fileup.svz_f_docup</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>body</MessagePart>
        <Field>svz_f_ticketdescription</Field>
      </MessagePartMap>
    </IncomingMessage>

The MessagePartMap tags are all non-obligatory, however if you don't include any it will just create a blank process. Any required fields must be filled in as they are necessary for the save transition to succeed. They tell the toolkit command where to put the data it parses. The transition tells the toolkit command to run a transition (in this case the save transition) when it has filled the fields.

The attachments file is a field in a subform. This fills the subform field in. The correct type of field should be used for each field, or errors may occur. The incoming mail process can handle attachments from emails and put them into defined file upload fields, as an in-built feature.

There is, of course, extra support for completing subforms as well, where you may want an email to add something to an existing process instead of creating a whole new one. This must be done as follows:

    <IncomingMessage>
      <Transition>
        <ZName>svz_transition_ticket_save</ZName>
      </Transition>
      <ProcessIDLookupField>svz_f_ticketid</ProcessIDLookupField>
      <ProcessIDLookupTable>svz_table_tickets</ProcessIDLookupTable>
      <MatchEmail>support@zednax.com</MatchEmail>
      <MatchSubject param="parent_process_id">.*Ticket: (\d+).*</MatchSubject>
      <SubForm>
        <Field>svz_f_ticketnotes</Field>
        <MessagePartMap>
          <MessagePart>from</MessagePart>
          <Field>svz_f_notecontact</Field>
        </MessagePartMap>
        <MessagePartMap>
          <MessagePart>subject</MessagePart>
          <Field>svz_f_notesubject</Field>
        </MessagePartMap>
        <MessagePartMap>
          <MessagePart>attachments</MessagePart>
          <Field>svz_f_fileup.svz_f_docup</Field>
        </MessagePartMap>
        <MessagePartMap>
          <MessagePart>body</MessagePart>
          <Field>svz_f_notedescription</Field>
        </MessagePartMap>
      </SubForm>
      <MessagePartMap>
        <MessagePart>from</MessagePart>
        <Field>svz_f_ticketrequester_lf</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>subject</MessagePart>
        <Field>svz_f_ticketsubject</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>attachments</MessagePart>
        <Field>svz_f_fileup.svz_f_docup</Field>
      </MessagePartMap>
      <MessagePartMap>
        <MessagePart>body</MessagePart>
        <Field>svz_f_ticketdescription</Field>
      </MessagePartMap>
    </IncomingMessage>

This would add a subform entry if the message subject contained the ticket number, it would find the ticket number and add a subform entry with the details provided. Very useful for updating ticket systems and other things where there is a main record but may have additional updates you want to be recorded.

The Field tag tells the process which field the subform is. The ProcessIDLookupField tag tells the process what field to match. The ProcessIDLookupTable tag tells the process what table to match the subform on. The MatchSubject tag tells the process what data to match with, using regex. The MessagePartMap tags tell us the same as before, what fields on the subform to match with the various sections of data received from the email.