Mail Task Using Parameter In Informatica
1. Introduction
This document is meant to provide information describing how to send the e-mail
which contains information that is to be retrieved from a table.
For this I created a mapping/session namely M1/S1 that will insert the data into a
parameter and that parameter can be used by a second session namely S2 which will
send the mail.
2. Problem Statement
An email is to be sent to the intended user and the content of the email is to be
extracted from a table.
3. Implementation/Solution
i) Mapping creation
Create a simple mapping(M1) that will insert the data into the target parameter
file. The below figure (Fig-1) shows the mapping which will be used to fetch the
data (here time left for completion of load) from the database table and that data
will be inserted into a parameter file.
Fig-1: This is the mapping which will insert data into the parameter file.
ii) Mapping Logic
Now the logic of the mapping is to be defined.
You can add the query in the Source Qualifier Transformation as per the data to be
retrieved from the table. Here I have used a simple query to fetch the time left for
the completion of the load.
Following figure (Fig-2) shows the manipulations done on the data in the expression
transformation. This data will be inserted into the parameter file and later used by
another session to send the mail.
Fig-2: Using expression to manipulate the data (It is Optional)
iii) Creation of Session to send the mail
For sending the mail, create a dummy session(S2) which will not insert data into any
table, but will just run the session. You can use a dummy source and a dummy target
for the creation of mapping. Make sure you define the Parameter in the properties of the
mapping. Following figure (Fig-4) illustrates it.
Fig-4:
For the session you need to only define the OnSuccessE-mail property in the
components tab which will use parameter having some data in the parameter file.
On clicking on the Edit Option for the OnSuccessE-mail a pop-up will appear.
Here you can set the properties like Email User Name, Email Subject and Email Text.
The parameter can be used in the Subject and the Text.
Refer the figure (Fig-3) below.
$$ELAPSED_TIME: This is the parameter which will take value from the parameter file.
Fig-3: Changing the properties of the email task.