Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

What is an Email Action?

Insert excerpt
_action_email
_action_email
nopaneltrue
 actions send emails to specified addresses.

The Email action can be used to send one or multiple emails. If 100 records are pushed into the Actionflow then 100 emails will be sent, unless a phase is used to send a single email. 

For the full list of Email action

Insert excerpt
_property_settings
_property_settings
nopaneltrue
, see Email Action Properties.

Creating Email Actions

  1. Click and drag the 
    Insert excerpt
    _action_email
    _action_email
    nopaneltrue
     icon from the toolbar onto the canvas
  2. Enter a name for the Email action, then select Create Action
  3. In the Email action  Properties on the right, populate the following details:
FieldDescriptionExample
NameName given to the Email Node. This will be displayed on the Actionflow canvas.MyEmailer
From

The email address the email will be sent from. This should match the email address specified as the login email in your Outbound Emailer.

Expand
titleHow can I find this?

In the 

Insert excerpt
_repository
_repository
namefull
nopaneltrue
, expand the 
Insert excerpt
_emailConfiguration
_emailConfiguration
nameaccounts
nopaneltrue
 and double-click on 
Insert excerpt
_emailConfiguration
_emailConfiguration
nameicon
nopaneltrue
 Outbound emailer.


notifications@phixflow.com
ToThe email address(es) the email will be sent to. Multiple addresses must be comma separated, if an expression evaluates to a list of email addresses then this will be converted automatically to the correct format.sale@phixflow.com
CC

The CC email addresses. Provided as a comma-separated list if multiple values are required. If an expression evaluates to a list then this will be converted automatically to the correct format.

This is an optional field.

info@phixflow.com, marketing@phixflow.com
BCC

The BCC email addresses. Provided as a comma-separated list if multiple values are required. If an expression evaluates to a list then this will be converted automatically to the correct format.

This is an optional field.

info@phixflow.com, marketing@phixflow.com
Subject

The email's subject.

This accepts JEP expressions in the format ${Connector.AttributeName} and ${Function}.

// Send the message followed by a timestamp

MyEmailer has run successsfully at ${now()}

is HTML

Insert excerpt
_toggle_on
_toggle_on
nopaneltrue
 Treat the Message as HTML.

Insert excerpt
_toggle_off
_toggle_off
nopaneltrue
 Treat the Message as plain text.

The default setting is plain text. This accepts JEP expressions in the format ${Connector.AttributeName} and ${Function}.


MessageThe content of the email. This can be text or JEP expressions. 

// Sends the content of the attribute MyMessage from the in pipe

${in.MyMessage}


Tip

All fields can be either literal values or expressions encapsulated within ${} syntax, for example ${in.MyValue}. ${} is used to wrap PhixScript.

Verifying Emails

It is possible to check an email has successfully been sent using the Email tab at the top of the system console. System Console → Console → Email Tab. See System Console.

Attachments

Currently unsupported in Actionflows.

To send an email with

an attachment, see Sending Emails.

Built-in Error Handling

Basic validation is performed to ensure that email addresses are well-formed. If they are not this will cause the Actionflow to fail immediately. Other errors, such as email addresses for accounts that don’t exist, won’t cause a failure of the Actionflow but they will result in an unsuccessful email send.

Opening an Email Client

The 

attachments, use the Attachments section in the

Insert excerpt
_property_settings
_property_settings
nopaneltrue
to select an existing Image Added File Table or create a new one. This file table must contain the attachments to be sent.

Once a file table has been selected, a filter field displays where a filter can be set to find all applicable files from that file table and include them as attachments on the sent email.

Sending Images

Create a new  Insert excerpt_action_gateway_action_gatewaynopaneltrue action to ensure an email is only sent when a new employee is saved but not when an existing employee is saved, and insert this between the  Insert excerpt_input_inputnopaneltrue node and 

Inline images can be sent within emails. For example, an input field (e.g. HTML component) can have images added to it and this can be sent as an email body using a

Insert excerpt
_action_
url
email
_action_
url
email
nopaneltrue
 can be used to open an email client where the user can send an email.

Expand
titleShow more
Insert excerptOpen URL NodeOpen URL Nodenameemailclientnopaneltrue HTML Comment
hiddentrue
Insert excerptEmail NodeEmail Nodenopaneltrue

Worked Examples

Here are worked examples using the Shop Data (available from the Learning Centre).

In this example, we are using:  

  • Shop Staff Form screen containing blank input fields, set up to create a new staff member  - this screen was created using the Edit Form template
  • A Shop Orders screen containing a grid of the Shop Orders data, Order Status filters buttons and a card container of the Shop Order Lines data  - this screen was created using the Multi-Tile template
Tip

If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Intermediate Application. For these example, we'll be working on the Save button on the Shop Staff Form, and creating a button on the Shop Orders screen

GIF/SCREENSHOT OF FINISHED RESULT   

Example 1: Send One Email For One Record

In this example, we'll modify the Actionflow on the Save button for when a new staff member is created. We'll configure this Actionflow to send an email to the Team Leader (i.e. you) with a reminder to complete a full induction.

  • On the Shop New Staff Form screen, open the Actionflow on the Save button
  • action.

    Built-in Error Handling

    Basic validation is performed to ensure that email addresses are well-formed. If they are not this will cause the Actionflow to fail immediately. Other errors, such as email addresses for accounts that don’t exist, won’t cause a failure of the Actionflow but they will result in an unsuccessful email send.

    Opening an Email Client

    The 

    Insert excerpt
    _action_url
    _action_url
    nopaneltrue
     action can be used to open an email client where the user can send an email.

    Expand
    titleShow more

    Insert excerpt
    Open URL Action Properties
    Open URL Action Properties
    nameemailclient
    nopaneltrue


    HTML Comment
    hiddentrue

    Insert excerpt
    Email Action Properties
    Email Action Properties
    nopaneltrue

    Worked Examples

    Here are worked examples using the Retail Data (available from the Learning Centre).

    In this example, we are using:  

    • Shop Staff Form screen containing blank input fields, set up to create a new staff member  - this screen was created using the Edit Form template
    • A Shop Orders screen containing a grid of the Shop Orders data, Order Status filters buttons and a card container of the Shop Order Lines data  - this screen was created using the Multi-Tile template
    Tip

    If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Intermediate Application. For these example, we'll be working on the Save button on the Shop Staff Form, and creating a button on the Shop Orders screen

    Example 1: Send One Email For One Record

    In this example, we'll modify the Actionflow on the Save button of the Shop Staff Form. We'll configure this Actionflow to send an email to the Team Leader (i.e. you) with a reminder to complete a full induction.

    1. On the Shop Staff Form screen, open the Actionflow on the Save button
    2. Create a new 

      Insert excerpt
      _action_gateway
      _action_gateway
      nopaneltrue
       action to ensure an email is only sent when a new employee is saved but not when an existing employee is saved, and insert this between the 
      Insert excerpt
      _input
      _input
      nopaneltrue
       node and 
      Insert excerpt
      _action_save
      _action_save
      nopaneltrue
       action

      Expand
      titleHow?

      Image Added

      • Ensure that staffID is mapped into the Gateway action from the input


    3. Click on the Save action on the canvas and rename this to: Save NEW Staff
      1. Ensure Auto Save Attributes is toggled on and change the Type to Insert
    4. Create an additional Save action and name it: Save EXISTING Staff
      1. Ensure Auto Save Attributes is toggled on and change the Type to Update
    5. Hover over the Gateway action
      1. Map the SaveOnly connector to the Save EXISTING Staff action
      2. Map the SaveAndEmail connector to the Save NEW Staff action 
      3. You should now have a Gateway action, followed by two Save actions, with the attribute staffID mapped to both
    6. Hover over the Save NEW Staff action on the canvas and select, out
    7. Click onto any blank canvas space and choose the 

      Insert excerpt
      _action_
      save
      email
      _action_
      save
      email
      nameicon
      nopaneltrue
       action
      Expand
      titleHow?

      Image Removed

      • Ensure that staffID is mapped into the Gateway action from the input
    8. Create an additional Save action, with the same setup as the existing Save action
    9. Map the Gateway action to both Save actions 
      1. You should now have a Gateway action, followed by two Save actions
    10. Hover over the Save action on the canvas that you will use for new employees (i.e. that will save and send an email) and select, out
    11. Click onto any blank canvas space and choose the 

      Insert excerpt_action_email_action_emailnameiconnopaneltrue iconEnter a suitable name for the node and select Create Action
       icon
      1. Enter a suitable name for the node and select Create Action
    12. Map across the staffID attribute from the table to the Email action
    13. Click on the input connection point, under Connections, and map in the following attributes:
      1. departmentID
      2. departmentName
      3. employmentType
      4. first_name
      5. last_name
      6. startDate
    14. Then map these attributes into the Email action

    Checkpoint

    Image Added

    Email Action Setup

    1. Click on the Email Action to open its Properties and pin the tab
    2. For the From field, we need to use the email address specified as the login email in your Outbound Emailer; to find this, in the 
      Insert excerpt
      _repository
      _repository
      namefull
      nopaneltrue
      , expand 
      Insert excerpt
      _emailConfiguration
      _emailConfiguration
      nameaccounts
      nopaneltrue
      1. Double-click on 
        Insert excerpt
        _emailConfiguration
        _emailConfiguration
        nameicon
        nopaneltrue
         Outbound emailer and copy the login email 
    3. Paste this into the From field on your pinned 
      Insert excerpt
      _action_email
      _action_email
      nopaneltrue
       properties, and enter the following:
      1. To: enter your email address
        1. This way you can see if the Actionflow is working
      2. Subject:

        Code Block
        languagejs
        themeEmacs
        New Employee: ${in.firstNamefirst_name} ${in.lastNamelast_name}


      3. is HTML: Toggle on 
        Insert excerpt
        _toggle_on
        _toggle_on
        nopaneltrue
         
      4. Message:

        Code Block
        languagejs
        themeEmacsEmacs
        Hello ${_user.name},
        
        You have a new team member! Here are ${in.firstNamefirst_name} ${in.lastNamelast_name}'s details:
        
        ID Number: ${in.staffID}
        
        Start Date: ${toString(in.startDate} 
        
        toString(_fromDate,"dd MMMM yyyy")}
        
        Department: ${in.departmentIDdepartmentNamedepartmentID} ${in.departmentName}
        
        Contract Type: ${in.employmentType}
        
        Please ensure ${in.firstNamefirst_name} ${in.lastNamelast_name} completes their full induction training and all training sign offs are completed by dateAdd(${by ${toString(dateAdd(in.startDate},_WEEK_OF_YEAR, 2)YEAR, 2), "dd MM yyyy")}.


        1. Leave all other fields blank
      5. Excerpt

        -include_finish_finishnopaneltrue

        -include
        _finish
        _finish
        nopaneltrue

    Checkpoint

    Image Added

    Testing

    1. To test the Actionflow:
      1. Create a new staff member using the Staff Form and if you provided your own email in the To field, you will receive the email you set up above
      2.  Update an existing staff member and after saving, you should not receive an email 

    Example 2: Send One Email For Multiple Records

    In this example, we'll configure a button to run a processing check of all order lines for all incomplete orders. This will check for any incomplete orders where all order lines are marked as 'Closed'. Where an order's order lines are all closed, the order will be updated to Completed and an email will be sent detailing how many orders have been updated to completed Completed that day.

    To In an Actionflow, to send one email for multiple records, an additional phase will

    Insert excerpt
    _action_phase
    _action_phase
    nopaneltrue
     will be required.

    Image Added

    Setup the Views and Calculate Action

    1. On the Shop Orders screen, use the palette to create a button that will initiate the Actionflow
    2. Right-click on the button and 
      Insert excerpt
      _actionflow_add
      _actionflow_add
      nopaneltrue
       
    3. On the Actionflow canvas, configure an Input of On Click
    4. Add a

      Insert excerpt
      _action_view
      _action_view
      nopaneltrue
       Action and set the Primary Table to the Orders data

    5. Filter on the View Action to only retrieve the incomplete orders


      1. Expand
        titleHow?

        Add a Filter with the filter conditions:

        1. Status not equals Completed 

        Add Output Attributes:

      2. OrderID
      3. Status

        1. orderID
        2. status

        For more help on using View actions, see View Action Configuration.


      4. Remember to save the View Action properties which will display with a * if unsaved
        1. Image Added
    6. Connect the input to this View Action

    7. Add a

      Insert excerpt
      _action_calculate
      _action_calculate
      nopaneltrue
       Action from the toolbar

      1. This Calculate Action will be to used in a lookupto change the order status

    8. Connect the View Action to

      the Calculate Action

      the Calculate Action

    9. Map across the attributes orderID and status

      Checkpoint
      Image Added


    10. Add another

      Insert excerpt
      _action_view
      _action_view
      nopaneltrue
       Action from the toolbar to the canvas and set the Primary Table to the Order Lines data
      nopaneltrue
       Action from the toolbar to the canvas and set the Primary Table to the Order Lines data

    11. Hover over the Calculate Action and choose Add Lookup, and give the lookup a suitable name, e.g. ORDthen click on the View action you just created
    12. Click on the View action node and set the Output Attributes:
      1. lineStatus
      2. orderID
      3. orderLineID
      4. orderLineNumber
    13. Filter on the View Action to only retrieve Open order lines, and where the orderID from the Orders data equals the orderID from the Order Lines data

      1. Expand
        titleHow?

        Add a Filter with two filter conditions:

        1. Where ALL of the following are true:
          1. LineStatus not equals Closed
          2. OrderID equals OrderID
    14. Hover over the Calculate Action and choose Add Lookup, then click on the lookup connector

    15. Configure the Incoming Mappings:
      1. OrderID
    16. Configure the Outgoing Mappings:
      1. LineStatus
      2. OrderID
      3. OrderLineID
      4. OrderLineNumber
        1. are true:
          1. lineStatus not equals Closed
            1. The field should be interpreted as an Literal value
          2. orderID equals orderID
            1. The field should be interpreted as an Expression



        Checkpoint

        Image Added


    17. Click on the lookup connector to configure the Request (Incoming) Mappings:
      1. Map across orderID
    18. Configure the Return (Outgoing) Mappings:
      1. lineStatus
      2. orderID
    19. Click on the Calculate Action and  and using the function countElements, add two Output Attributes:
      1. add an Output Attribute that counts will be used to modify the order's Status. The expression should count the records coming from the lookup and where . Where this is more than zero, returns the Order Status that is currently set but where return the order's status. Where this is zero, returns  return the string, "Completed"
        1. zero records means that all Order Lines are Closed
        2. the "Completed" string will be mapped to the Order Status
      2. add an Output Attribute that counts will be used to modify the order's Completion Date. The expression should count the records coming from the lookup and where this is more than zero, returns return NULL but where this is zero, returns return today's date 

        Expand
        titleHow?

        Add an Output Attribute for the status:

        Code Block
        themeEmacs
        titleStatusOutputAttribute
        if(
            countElements(luORD) > 0, in.status, 
            
            //flag record as Completed if all order lines Closed
            "Completed"
        )

         Add an Output Attribute for the completion date:

        Code Block
        themeEmacs
        titleCompletionDateOutputAttribute
        if(
            countElements(luORD) > 0, _NULL, 
            
            //return today's date for complete orders
            now()
        )



    20. Add a
      Insert excerpt
      _action_save
      _action_save
      nopaneltrue
       Action to the canvas that saves data back to the Orders dataset
    21. Connect the Calculate action to this Save action, and map across:
      1. The Completion Date Output Attribute StatusOutputAttribute onto the CompletionDate status in the data
      2. The Status Output Attribute CompletionDateOutputAttribute onto the Status completionDate in the data
      3. The OrderID orderID from the Orders View onto the OrderID orderID in the data
      4. Toggle on Auto Save Attributes in the Save Action Properties

        Change the Type to Update in the Save Action Properties

    Checkpoint

    Image Added

    Setup the Email Phase

    Create an additional phase in the Actionflow to send an email in. This is required to ensure only one email is sent regardless of the amount of records passing through the Actionflow.

    As data cannot be passed between phases, this Actionflow the emailing phase will include a lookup to the Orders data, specifically to the data that was saved as part of the first phase of the Actionflow.

    1. Add a 
      Insert excerpt
      _action_phase
      _action_phase
      namestart
      nopaneltrue
       to the canvas and create an additional phase to send the email in
    2. Connect the Save action to the Start Phase action
    3. Open the Emailing Phase and configure an Input of On Phase Start
    4. Add a 
      Insert excerpt
      _action_calculate
      _action_calculate
      nopaneltrue
       Action that will be used for to count records coming from a lookup
    5. Connect the input to the Calculate Action
    6. Add a
      Insert excerpt
      _action_view
      _action_view
      nopaneltrue
       Action with the Orders data as the Primary Table
      1. Filter on the View Action to only retrieve Orders with a Completion Date of today 

        1. Expand
          titleHow?

          Add a Filter with the filter condition:

          1. CompletionDate equals today()


    7. Hover over the Calculate Action and choose Add Lookup, then click on the lookup connectorConfigure the Outgoing Mappings:
    8. CompletionDate
    9. OrderIDView action you made above
    10. On the Output Attributes section of the View action, drag and drop the attributes completionDate and orderID
    11. Click on the lookup connector to map the Return (Outgoing) Mappings:
      1. completionDate
      2. orderID
    12. Click on the Calculate Action and using the function countElements, add an Output Attribute that simply counts the records coming from the lookup connector 

      Expand
      titleHow?

      Add an Output Attribute:

      1. Type: Integer
      2. Expression: 

        Code Block
        themeEmacs
        countElements(lu)



    13. Add a
      Insert excerpt
      _action_email
      _action_email
      nopaneltrue
       Action to the canvas and connect the Calculate Action to this
      1. Map across the above Output Attribute from the Calculate Action action to the Email action
    14. Click on the Email Action to open its Properties, and enter the following:
      1. From: use the email address you used in Example 1
      2. To: enter your email address
        1. This way you can see if the Actionflow is working
      3. Subject:

        Code Block
        languagejs
        themeEmacs
        Order Completion Check


      4. is HTML: Toggle off 
        Insert excerpt
        _toggle_off
        _toggle_off
        nopaneltrue
         
      5. Message:

        Code Block
        languagejs
        themeEmacs
        Overnight order processing run finished at ${toString(now(),"dd MM yyyy, HH:mm:ss")}.
        
        ${in.CountCompletedTodayYourOutputAttribute} order(s) now completed.


        1. Ensure you modify the above code with the name of your Output Attribute
        2. Leave all other fields blank
      6. Insert excerpt
        _finish
        _finish
        nopaneltrue

    Checkpoint

    Image Added

    Test the Actionflow

    To test the Actionflow we need an Open or Processing order that has all of its order lines set to Status of Closed. 

    1. On the Shop Orders screen, use the filers filters to find an Open or Processing order
    2. Change Choose an Order and change all of its Order Lines to Closed and Save each change
    3. ZB THIS IS A ROUGH GIF, NOT FINAL 
    4. Image Removed
    5. Click on the button you created on the screen to initiate the Actionflow


    Image Modified