# Communication

Communication actions provide additional communication and messaging activities.

# Email

Email.png

Action Function: The Email action is used to distribute Email messages to end users both within and outside the organization.

Action Outputs: The Email Activity returns the following:

  • Successful – The action successfully generated an email to the designated recipient(s)

  • Unsuccessful – The action failed to send the message to the designated recipient(s)

Action Properties:

Label

A label for the activity.

Properties

From (optional)

This property, if used, sets the “From” address value for any outgoing emails generated via this step. The value set in this field will override any global default “From” address value, as set in the Administration, System Management, Email screen.

The value for this property can be static (hard-coded), or dynamically generated using request-specific variable or content data.

External Recipient (optional)

This property supports any email address (or addresses), either internal or external, that should be sent an email notification when the workflow executes this step.

The email addresses assigned here can either be static (hard-coded) or dynamically generated using request-specific variable or content data. A fully qualified external email address (such as, john.doe@company.com) is an acceptable value for this field.

Actor Recipient (optional)

This property is used to specify the Users who should receive the Email generated by this action. Refer to the information for “Assign Actor(s)” for instructions to set this property.

Send to Work Assignees (optional)

This Yes/No property offers the option to send this email to all active work assignee resources for a directly prior executed Human Activity (e.g., Approval, Choice, Information, or Task actions). NOTE: If set to “Yes,” the prior Human action must be directly connected to this Email step in the workflow design in order to identify the work assignees properly.

In addition, if this option is set to “Yes,” then special replacement data elements from the associated Work Item assignments will become available for use within the email Subject, Body, and/or Body Template file as well:

  • [WI_WorkItemId] – unique internal ID used to identify the individual relationship of a Human Activity instance to a given Actor; this value can be used to generate links in an email directly to a specific work item via a web browser

  • [WI_VirtualActorId] – internal ID to identify the assigned Actor

  • [WI_ActivityDisplayName] – name of the prior Human Activity

  • [WI_ResponseByUTC] – the Response By time (in UTC) as determined by the prior Human Activity Timeout value

  • [WI_ResponseBy] – the Response By time determined by the prior Human Activity Timeout value

  • [WI_Priority] – the priority set for the prior Human Activity

  • [WI_Subject] – the subject defined for the prior Human Activity

  • [WI_Notes] – the Body defined for the prior Human Activity

  • [WI_ActivityType] – the type of activity for the prior Human action

  • [Email_Body] – Refers to the specific text from the email action’s Body property when templates are used for the email action

CC (optional)

This property can be used to carbon copy a recipient (or recipients) on emails generated via this step.

BCC (optional)

This property can be used to blind carbon copy a recipient (or recipients) on emails generated via this step

Subject (optional)

This property is used to set the Subject line for outgoing emails generated via this action. This field offers a text editor window where the desired Subject text can be configured and formatted as needed.

Body (optional)

This property is used to set the message body of the Email sent to the designated recipient(s) via this action. This field offers a rich text editor window where the desired Body text content can be defined.

Body Template (optional)

This property allows for specifying an email template, containing plain text or HTML, to defines the email message body to be sent. To use this property, the applicable template file(s) must be defined using the “Designer, Tools, Email Templates” function.

The name of the email template may be referenced in this property. An example Body Template using HTML is shown below:

<head>
    <style type="text/css">
        .style1 {
            width: 100%;
        }

        .style2 {
            width: 187px;
            border-right: 1px solid black;
            border-bottom: 1px solid black;
        }

        .style3 {
            border-bottom: 1px solid black;
        }
    </style>
</head>
Dear [%#Value.SendTo.name%],
<br>
<table class="style1" style="border: 1px solid black;">
    <tr>
        <td class="style2" valign="top">
            &#91;WI_WorkItemId&#93;</td>
        <td class="style3">
            [WI_WorkItemId]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_VirtualActorId&#93;&nbsp;</td>
        <td class="style3">
            [WI_VirtualActorId]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_ActivityDisplayName&#93;&nbsp;</td>
        <td class="style3">
            [WI_ActivityDisplayName]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_ResponseByUTC&#93;&nbsp;</td>
        <td class="style3">
            [WI_ResponseByUTC]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_ResponseBy&#93;&nbsp;</td>
        <td class="style3">
            [WI_ResponseBy]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_Priority&#93;&nbsp;</td>
        <td class="style3">
            [WI_Priority]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_Subject&#93;&nbsp;</td>
        <td class="style3">
            [WI_Subject]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_Notes&#93;&nbsp;</td>
        <td class="style3">
            [WI_Notes]&nbsp;</td>
    </tr>
    <tr>
        <td class="style2" valign="top">
            &#91;WI_ActivityType&#93;</td>
        <td class="style3">
            [WI_ActivityType]</td>
    </tr>
</table>
<br>
Method one: <a href="http://hascdev.pmg.net/spe/[WI_ActivityType]Simple.aspx?wi=[WI_WorkItemId]">View In Browser</a>
<br>
Method two: <a href="http://hascdev.pmg.net/spe/SimpleWorkRedirect.aspx?wi=[WI_WorkItemId]">View In Browser</a>
<br>
&nbsp;Thanks!
<br>
[%#Variable.SubmittedBy.userPrincipalName%]

Example Body Template HTML

An example Body Template using plain text is shown below:

Dear V{{SendTo.Name}},
-------------
WorkItemId: [WI_WorkItemId]
VirtualActorId: [WI_VirtualActorId]
ActivityDisplayName: [WI_ActivityDisplayName]
ResponseByUTC: [WI_ResponseByUTC]
ResponseBy: [WI_ResponseBy]
Priority: [WI_Priority]
Subject: [WI_Subject]
Notes: [WI_Notes]
------------
Thanks!
V{{SubmittedBy.Name}}

Example Body Template Text

Attachments (optional)

This property can be used to add file attachments to the outgoing email message generated by this action. Attachments may be sent from the related PMG submitted form fields or from the file system. Files attached from the file system must accessible by the application server workflow service which is processing the email action.

To attach specific form fields of type “File” to an email, specify the form field using a mapped form field ID in the property. For example, if a mapped form has a file attachment field named “AttachedFiles”, then enter Form.AttachedFiles into this property to include these files.

File Variable Attachments This property is used to attach file variables to the email as attachments.

To embed file variables as images within the email body, include the file variable in the file variable attachments property, and then refer to the "CID Embedded Images (Inline Images)" in the HTML for the email using the file variable name. For example, using a File Variable named "MyProfileImage", you can reference it as:

<img src='cid:[MyProfileImage]'/>

A more complete but simple HTML example body for the email is below.

<!DOCTYPE html>
<html lang="en-us">
  <body>
    This is some lead in text. The image should be below.
    <p>
    <img src="cid:[EmbeddedImageFile]" />
    <p>
    And this is the end of the text, with the image above.
  </body>
</html>

Attaching files from the file system: Files may be attached by specifying the full access path information for the file(s) to be attached. Multiple files can be attached by separating the file references with a semicolon ‘;’.

Send All Request Attachments

This Yes/No property, set to “No” by default, specifies whether all files found within a given request form tied to the current workflow should be attached to outgoing emails generated by this action. If set to “Yes,” all files submitted to mapped File type questions in an associated request form would be attached to the outgoing message. Otherwise, if set to “No,” only those individual contents specified in the preceding Attachments property would be attached to the outgoing emails, if any.

Send Separate Emails

This Yes/No property, set to “No” by default, designates whether the workflow will generate one email for all recipients or a separate email for each individual recipient.

Mail Format (optional)

This property, set to “HTML” by default, is used to set the format of the outgoing emails generated via this action – either HTML or Plain Text.

Priority Choose a message priority for the outgoing email.

Alert on Error (optional)

This Yes/No property is used to designate whether any protocol errors encountered while trying to send this email should be logged. If logged, any such error data would be visible to Admin users on the Administration, Log Viewer screen, which can help facilitate troubleshooting. As such, the recommended setting for this property is “Yes.”

# QR Code

send-message.png

Action Function: The QR Code action will generate a QR (quick response) code image for a provided URL.

Action Outputs: The Send Message action returns the following:

  • Successful – the action ran without error

  • Unsuccessful – there was some error running the action

Action Properties:

Label

A label for the activity

Properties

Image File Name (png)

An optional file name to give the generated image file (PNG formatted). If no name is given an automatically generated name will be used.

URL/Link

The URL or link to embed in the generated QR code

Pixels per module (default 20)

The number of pixels per module to use in the generated image

Target file variable

The file variable name to store the generated QR code

# Send Message

send-message.png

Action Function: The Send Message action enables one workflow to send information in real time to one or more workflows (including itself) which are using a Wait for Message action with a matching key. The activity can send an output for the waiting workflow activities to follow and can optionally send payload information. Options are available to support high throughput message sending and receiving.

Action Outputs: The Send Message action returns the following:

  • [blank] – This path is always followed

  • Successful – the Message could be sent, indicating that one or more workflows with a Wait for Message were found with a matching key

  • Not Found – the Message was unable to be sent, indicating that no workflows with a Wait for Message were found with a matching key

  • Error – there was some error encountered sending the message

Action Properties:

Label

A label for the activity

Properties

Key erroricon (required)

This property specifies the Key value to match for corresponding Wait for Message actions that are waiting. The Key can be set as a static value, or can be generated dynamically using existing Variable, Content, and/or XML Variable data via the Field controls at the top of the property window.

Output erroricon (required)

This property defines the output that should be followed by the matching Wait for Message activities. The output can be set as a static value, or can be generated dynamically using existing Variable, Content, and/or XML Variable data via the Field controls at the top of the property window.

Payload

This property allows the Send Message activity to transmit additional information to the waiting workflows. The value specified in this property field is sent as a string, which can also be an XML document or JSON, or other. The corresponding Wait for Message activities can store this information into their own string variables as needed. The Payload can be set as a static value, or can be generated dynamically using existing Variable, Content, and/or XML Variable data via the Field controls at the top of the property window.

Synchronous Delivery

When Synchronous Delivery is False (default), the action will return quickly, as it will queue the message to be delivered to all matching actions. Awaiting “Wait for Message” actions will receive the message in a background process. When Synchronous Delivery is True, the action will wait and stall until all the matching awaiting actions have received the message. This mode can be used when you need to wait and know that all the actions which are waiting on this message have received the message.

Max Synchronous To Send

When Synchronous Delivery is True, you can use this property to limit the number of Wait For Message actions to be notified of the new message, at a time. For instance, if there is a large or unknown number of possible waiting actions for this message, you can notify them in batches, typically sending the message in a loop, until no matching waiting actions are found. Once no waiting actions are found, the Send Message action will follow out its “Not Found” path. Note: The waiting actions must consider the output a completion maker, or the same actions will continue receiving the same message.

# Wait for Email

wait-email.png

Action Function: The Wait for Email activity can be used to wait for incoming emails, or for a specified time period, as defined in the activity's properties. This action can also be used to filter incoming emails using specific conditions set in the properties. The activity can save an email Id that can then be used by the Email Parser action to store emails (completely or partially) into specified variables. Depending on the various property settings, the activity can provide different outputs.

Action Outputs: The Wait for Email activity returns the following:

  • Email Received – followed when an email matching the specified filter condition is received

  • All Email Received – followed when the maximum number of emails received has been met

Action Properties: For each of the “Match” properties of this action, the syntax follows the MS SQL “Like” patterns. For example, to match senders to a given address, a valid matching syntax is below.

%support@pmg.net%

Special characters may be specially prefixed with ‘\’.

Please see https://msdn.microsoft.com/en-us/library/ms179859.aspx for more details.

Label

A descriptive label for the action

Subject Match

This property is used to set a filter for incoming mail to match emails based on Subject.

Sender Match

This property is used to set a filter for incoming mail to match emails based on Sender.

Recipient Match

This property is used to set a filter for incoming mail to match emails based on Recipient.

Max Emails

This property is used to set the maximum number of emails to process. Once the maximum is reached, the output of All Emails Received is triggered. Leave this blank to process an unlimited number of emails.

Variable for email id

This property is used to save the generated email Id in a variable. This variable can be used with the Email Parser action to save email details into variables and to extract attachments to the file system. This variable should be of type “local” to best support multiple simultaneous email parsing scenarios.

# Wait for Message

wait-for-message.png

Action Function: The Wait for Message action can be used to wait for a message from an external source, or from another workflow which is using the Send Message action. Messages from external sources are received via Web Services (see PMG SPEWS documentation), or internally when the Send Message action is used within another workflow. This activity supports receipt of output messages and payload information from the external source.

Action Outputs: The Wait for Message action outputs events based on settings defined in its Outputs property. Additional outputs are:

  • *Completion Timeout – triggered when the time period specified in the Timeout for completion property has been reached

  • *Completion Warning –triggered when the time period specified in the Timeout for warning or Timeout for warning recurring property has been reached

Action Properties:

Label

A label for the activity

Properties

Message Key erroricon (required)

This property specifies the value to be used to identify matching incoming messages from either a corresponding Send Message workflow action or an external system via web services call.

The Key can be set as a static value, or can be generated dynamically using existing Variable, Content, and/or XML Variable data via the Field controls at the top of the property window.

Variable for Payload erroricon

This property designates the existing variable in which the incoming message payload should be stored. The payload is typically a simple string value, or XML set as a string, which, once stored as a variable, can be used subsequently within the workflow.

Outputs erroricon (required)

This property defines the specific Output values for the action, which are then used to route the workflow. Each output value added must be designated as a completion-maker or not, to indicate whether the workflow should leave this action behind or continue processing after following that output path.

Timeout for completion (optional)

This property specifies the time period that the activity should wait for a completion maker output value, as defined in the preceding Outputs field. This property sets the maximum amount of time the activity should process. If this property is left blank, the activity will continue to process indefinitely. To use this property, the workflow design will need to reflect a *Completion Timeout output path to be followed once the specified time limit is reached.

To set this timeout period, click into the text field, and enter the applicable raw time in Days, Hours, Minutes, and Seconds in the following format – (D.HH:MM:SS).

Timeout for warning recurring (optional)

This property specifies the time period that the activity should wait for a completion maker output before outputting a *Completion Warning. The time period specified in this property will output the *Completion Warning value on a recurring basis until a completion maker output is generated. To use this property, the workflow design will need to reflect a *Completion Warning output path to be followed each time the specified time limit is reached.

To set this timeout period, click into the text field, and enter the applicable raw time in Days, Hours, Minutes, and Seconds in the following format – (D.HH:MM:SS).

Timeout for warning (optional)

This property specifies the time period that the activity should wait for a completion maker output before outputting a single**Completion Warning* value. The time period specified in this property will generate the *Completion Warning output once, if a completion maker output is not reached in the specified time period. To use this property, the workflow design will need to reflect a *Completion Warning output path to be followed once the specified time limit is reached.

To set this timeout period, click into the text field, and enter the applicable raw time in Days, Hours, Minutes, and Seconds in the following format – (D.HH:MM:SS).

Variable for attachments ID

The SPEWS method, [/spe/spews.asmx?op=AlertActionByKeyWithPayLoadAndAttachments](file:///C:\spe\spews.asmx%3fop=AlertActionByKeyWithPayLoadAndAttachments), has a parameter, “sAttachments”. The syntax for sAttachments is below.

{
   "attachments": [
      {
         "name": "xml-schema.xml",
         "contentType": "text/xml",
         "file": "PHJlcXVlc3Q+DQoJPHFfQVdTX01hY2hpbmVzX3htbCBpZD0ibX="
      },
      {
         "name": "xml-schema.zip",
         "contentType": "application/zip",
         "file": "UEsDBBQAAAAIAO6LiUfDsOMangAAAEABAAAOAAAAeG1sLXNjaGVtYS54bW="
      }
   ]
}

When files are passed into this method, the Attachments ID GUID can then be set into a target variable for further use.

The attachments are stored into an internal SQL table with the following details.

Object: PMGSPE.dbo.WaitForMessagesAttachments
 
Column          | Type
----------------------------------
Id              | int
MessageId       | int
SetId           | uniqueidentifier
FileName        | nvarchar(250)
FileSize        | int
ContentType     | nvarchar(50)
Data            | image
CreatedDateTime | datetime

XmlVariable for attachments data

Details about the attached files from the above method can be stored into a target XML variable. The variable will be set with the following type of information about the attachments.

<attachments id="8d9fc755-94e7-438b-aed3-15bda61da140">
  <attachment>
    <id>22</id>
    <setid>8d9fc755-94e7-438b-aed3-15bda61da140</setid>
    <filename>xml-schema.xml</filename>
    <filesize>320</filesize>
    <contenttype>text/xml</contenttype>
  </attachment>
  <attachment>
    <id>23</id>
    <setid>8d9fc755-94e7-438b-aed3-15bda61da140</setid>
    <filename>xml-schema.zip</filename>
    <filesize>320</filesize>
    <contenttype>application/zip</contenttype>
  </attachment>
  <attachment>
    <id>24</id>
    <setid>8d9fc755-94e7-438b-aed3-15bda61da140</setid>
    <filename>PMGSPEUtils.Office.dll.zip</filename>
    <filesize>4893</filesize>
    <contenttype>application/zip</contenttype>
  </attachment></attachments>

# Send Message To Hub

Action Function: The Send Message To Hub action allows a workflow to send a message to remote clients which are actively receiving messages on the PMG Message Hub. See the “Message Hub” section for more information about the Message Hub and usage.

Action Outputs: The action has no outputs

Action Properties:

Label

A label for the activity

Properties

Message Key

This property specifies the key to use when sending the message to the hub. This is also referred to as the “Reference” in the Message Hub administration screen test utilities.

Message

This property specifies the message to send to the hub