A Notification Task step sends a notification to specified recipients.
You can configure the Notification Task step to send an email notification. For example, you can send an email notification to inform recipients about the number of success rows and error rows that were encountered in a Data Task step of a taskflow.
You can define properties for the Notification Task step to configure the email recipients and email content. You cannot use distribution lists in the Email To, Email Cc, and Email Bcc fields.
The following sections describe the Notification Task step properties:
General properties
In the general properties, you can specify a descriptive name for the Notification Task step.
The name can contain only alphanumeric characters, underscores (_), spaces, and Unicode characters. The name can't contain curly brackets {}, full width lowline (_), and hyphen (-).
Notification Task properties
You can configure the following Notification Task step properties:
Notification Method
The type of notification to be sent.
The value of this field is set to Email by default. You cannot edit this value. The other values are reserved for future use.
Email To
Required. The primary recipients for the email notification.
Use one of the following options to specify the value for this field:
- Content. Enter one or more valid recipient email addresses. You can also add fields that contain valid email addresses. Separate email addresses and fields with a comma (,) or a semicolon (;).
- Field. Select the field that the Taskflow Designer uses to write the email addresses into this field when this step executes. You can select an input field or a temporary field that was added in any other step in the taskflow.
- Formula. Open the formula editor to specify a formula that calculates the value for this field.
Default is Content.
Email Cc
The recipients who need to be sent a copy of the email notification.
Use one of the following options to specify the value for this field:
- Content. Enter one or more valid recipient email addresses. You can also add fields that contain valid email addresses. Separate email addresses and fields with a comma (,) or a semicolon (;).
- Field. Select the field that the Taskflow Designer uses to write the email addresses into this field when this step executes. You can select an input field or a temporary field that was added in any other step in the taskflow.
- Formula. Open the formula editor to specify a formula that calculates the value for this field.
Default is Content.
Email Bcc
The additional recipients who need to be sent a copy of the email notification. The recipients in the Email To and Email Cc fields will not be able to see the recipients in the Email Bcc field. If the field contains more than one recipient, the recipients will not be able to see the other recipients in the Email Bcc field.
Use one of the following options to specify the value for this field:
- Content. Enter one or more valid recipient email addresses. You can also add fields that contain valid email addresses. Separate email addresses and fields with a comma (,) or a semicolon (;).
- Field. Select the field that the Taskflow Designer uses to write the email addresses into this field when this step executes. You can select an input field or a temporary field that was added in any other step in the taskflow.
- Formula. Open the formula editor to specify a formula that calculates the value for this field.
Default is Content.
Email Subject
A short and descriptive subject that introduces the email.
Use one of the following options to specify the value for this field:
- Content. Enter a subject for the email.
- Field. Select the field that the Taskflow Designer uses to write the email subject into this field when this step executes. You can select an input field or a temporary field that was added in any other step in the taskflow.
- Formula. Open the formula editor to specify a formula that calculates the value for this field.
Default is Content.
Email Content Type
The type of formatting that you want to use for the email content.
Select one of the following values:
- HTML. Select HTML to use formatting options such as bold, italics, underlines, lists, indentations, and fonts. You can also insert tables and links.
- Plain Text. Select Plain Text to add regular text without any formatting and special layout option.
Default is Plain Text.
Email Body
The content that you want to send in the email.
Use one of the following options to specify the value for this field:
- Content. Enter content for the email body.
You can click Edit Content to open a rich text editor for formatting the content.
The email content appears within HTML tags on the All Jobs, Running Jobs, and My Jobs pages.
- Field. Select the field that the Taskflow Designer uses to write the email body into this field when this step executes. You can select an input field or a temporary field that was added in any other step in the taskflow.
- Formula. Open the formula editor to specify a formula that calculates the value for this field.
Default is Content.
Email notification examples
You can define the content of the email body based on the number of data tasks in the taskflow to send an email notification with HTML content.
Single data task
When you use the Notification Task step for a single data task, you can enter the data task details in the email body with the source type as content.
For example, you might pass the following XQuery expression:
Hi, Data task with Run Id { $temp.DataTask1[1]/output[1]/Run_Id } started at { $temp.DataTask1[1]/output[1]/Start_Time } and completed at { $temp.DataTask1[1]/output[1]/End_Time } with a status of { $temp.DataTask1[1]/output[1]/Task_Status }
In the above example, if the data task runs successfully, you will receive the output details in an email notification.
In case the data task fails, you can use the fault fields in the XQuery expression to determine the reason for failure as shown in the following example:
Hi, Data task with Run Id { $temp.DataTask1[1]/fault[1]/detail[1]/errOutputDetail[1]/Run_Id } started at { $temp.DataTask1[1]/fault[1]/detail[1]/errOutputDetail[1]/Start_Time } and completed at { $temp.DataTask1[1]/fault[1]/detail[1]/errOutputDetail[1]/End_Time } with a status of { $temp.DataTask1[1]/fault[1]/detail[1]/errOutputDetail[1]/Task_Status }
Multiple data tasks
When you use the Notification Task step to send an email summary for multiple data tasks, you can use an XQuery expression with the source type as formula.
For example, you might pass the following XQuery expression for a taskflow that contains two data tasks named <DataTask1> and <DataTask2>:
In the above example, if the data task runs successfully, you will receive the output details in an email notification.
In case of failed data tasks, you can use the fault fields in the XQuery expression to determine the reason for failure as shown in the following example:
Before sending an email notification, you might want to convert the timezone based on the recipient's location. To do this, you can use the infa:format XQuery function in the email subject or email body. For more information about converting the timezone using a formula, see the following community article:
Certain restrictions apply when you use the Content option to specify the email body and the HTML option to specify the email content type in a Notification Task step.
Consider the following guidelines:
•If you use HTML content, you may not receive a valid formatted email. You must use a variable to define the HTML content and serialize the variable in the Expression Editor.
For example, if the HTML content is as follows:
<html> Order {$output.OrderID} has been submitted for {$input.CustomerEmail}. <br/> <b>Order details for your records.</b> <br/><br/> Item Cost: {$temp.InventoryDetails[1]/ItemCostPrice} Item Count: {$temp.InventoryDetails[1]/ItemCount } Item Sell Price: {$temp.InventoryDetails[1]/ItemSellingPrice } Commission Percentage: {$temp.InventoryDetails[1]/SalesCommissionInPercentage } <br/><br/> <b>Margins</b> Overall Profit: {$output.Calculate_Margin_ServiceResponse[1]/MarginBeforeCommission} Sales Commission: {$output.Calculate_Margin_ServiceResponse[1]/SalesCommission} Profit after Commission: {$output.Calculate_Margin_ServiceResponse[1]/MarginAfterCommission} </html>
Use the following content in the Expression Editor to define a variable for the HTML content and serialize the variable to receive a valid formatted email:
let $doc := <html> Order {$output.OrderID} has been submitted for {$input.CustomerEmail}. <br/> <b>Order details for your records.</b> <br/><br/> Item Cost: {$temp.InventoryDetails[1]/ItemCostPrice} Item Count: {$temp.InventoryDetails[1]/ItemCount } Item Sell Price: {$temp.InventoryDetails[1]/ItemSellingPrice } Commission Percentage: {$temp.InventoryDetails[1]/SalesCommissionInPercentage } <br/><br/> <b>Margins</b> Overall Profit: {$output.Calculate_Margin_ServiceResponse[1]/MarginBeforeCommission} Sales Commission: {$output.Calculate_Margin_ServiceResponse[1]/SalesCommission} Profit after Commission: {$output.Calculate_Margin_ServiceResponse[1]/MarginAfterCommission} </html> return serialize($doc)
•If the HTML content contains valid XML, use the XQuery function util:toXML in the Expression Editor to serialize the content into the String format.
•If the HTML content does not contain valid XML, you must convert the HTML content to valid XML. Sometimes even if the HTML content contains valid XML, you do not receive a valid formatted email. In this case, you must use the String Concat function.
•If the HTML content does not contain valid XML, you must either convert the HTML content to valid XML or use the String Concat function with an escape character.
The following example shows how to use the String Concat function with an escape character: