Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

Taskflows

Taskflows

Email notification examples

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>:
util:toXML(<html> <head><h3>Taskflow Tasks Status Summary</h3></head> <body> <table> <tr> <th>Task Name</th> <th>Job Id</th> <th>Status</th> <th>Start Time</th> <th>End Time</th> </tr> {   let $dataTasks := ($temp.DataTask1, $temp.DataTask2) for $dataTask in $dataTasks return <tr> <td>{ local-name($dataTask) }</td> <td>{ $dataTask[1]/output[1]/Run_Id }</td> <td>{ $dataTask[1]/output[1]/Task_Status }</td> <td>{ $dataTask[1]/output[1]/Start_Time }</td> <td>{ $dataTask[1]/output[1]/End_Time }</td> </tr> } </table> </body> </html>)
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:
util:toXML(<html> <head><h3>Taskflow Tasks Status Summary</h3></head> <body> <table> <tr> <th>Task Name</th> <th>Job Id</th> <th>Status</th> <th>Start Time</th> <th>End Time</th> </tr> { let $dataTasks := ($temp.DataTask1, $temp.DataTask2) for $dataTask in $dataTasks return <tr> <td>{ local-name($dataTask) }</td> <td>{ $dataTask[1]/fault[1]/detail[1]/errOutputDetail[1]/Run_Id }</td> <td>{ $dataTask[1]/fault[1]/detail[1]/errOutputDetail[1]/Task_Status }</td> <td>{ $dataTask[1]/fault[1]/detail[1]/errOutputDetail[1]/Start_Time }</td> <td>{ $dataTask[1]/fault[1]/detail[1]/errOutputDetail[1]/End_Time }</td> </tr> } </table> </body> </html>)
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:

0 COMMENTS

We’d like to hear from you!