You are on page 1of 5

E-mail from Turbo Integrator

TI processes when executed interactively, will let users know whether the process completed successfully or had some
errors. For those TI processes that are executed through chore, the outcome of the process execution (success and/or
failure) is determined by looking at the target cube or sifting through the log files. Processes that are critical to end users
often warrant an e-mail to support team, should the process in question were to fail.
This article stems from such a need, where in support team for a business critical application in TM1 required e-mail
notifications, on when chore began, succeeded or failed. To accomplish this we will need 3 important pieces a VB Script,
a TM1 cube and a TI Process.
VB Script:
This script will be the one that actually sends the e-mail. It requires certain parameters and will send an e-mail based on
the information supplied. Script is attached with this article SendMailWithParameters.vbs. Attached script requires 4
mandatory parameters (From address, To addresses, Subject line, Body) and one optional parameter, the process name.
Place this VB script in the data directory. You can also google for one and customize it to your need.
The last parameter is required when you want to send a process log file. When a process fails, it will create a file in the
logs directory with name like TM1ProcessError_DATE_PROCESSNAME.log. There is every possibility that the log files
directory will have more than one error log file for the same process; so the script looks for the one with the latest
timestamp and attaches it to the e-mail.
Assuming TM1 data and logs directories share same lineage i.e. they are under same parent folder, the path to the
log files is shown below. If your logs folder is in different place than data then change the path accordingly in line 17

Fig 1: LogPath variable

In line 39, fill in your SMTP server name within double quotes.

Fig 2: SMTP Name variable

In line 44, fill in the port number. Usually it is 25; if it doesnt work, then check with your exchange administrator for the
information.

Fig 3: SMTP Port variable

TM1 Cube:
This is the data cube, which will house required parameters information for all the processes that youd like to monitor. It
has only 2 dimensions: Applications and Details.
In our case the cube is called E-Mail and the 2 dimensions are Mailing_Applications and Mailing_Details. These 2
dimensions are attached with this article. You will have to create a cube in your environment using these 2 dimensions.
Below is a snapshot of what the cube looks like:

Fig 4: Sample data in the TM1 Cube

For each process we monitor there are 2 entries in the Application dimension one for success and another for
failure; ex: BR_Capital_Load (sent when process BR_Load_Capital succeeds) and BR_Capital_Fail (sent when process
BR_Load_Capital fails)
There are fields to key in up to 10 recipients. You can easily increase/decrease that by editing the dimension. In
such cases, you will have to make an additional change in the TI Process PROLOG tab (see below)
Attachment field is blank for success and has corresponding process name for failure. In our case, we are sending
the log file of the process in case of an error. With this approach, the support person can open the log file from
his/her smart phone and get a brief idea of the type of error encountered
The sender id is a generic mail address that does not really exist. Id recommend to use words DEV, TEST or PROD
in the senders name field, so you will know when to panic and when not to. (Note: The screenshot is from E-Mail
cube in our development environment)
Power users e-mail is present in failure; so they know when critical TI processes fail

TI Process:
This parameterized TI process will accept one parameter an element from the Mailing_Applications dimension and read
from the fore mentioned cube all the details related to that and execute the VB Script. The TI Process is attached with
this article and it is named Email Using Cube
Data Source: None
Variables: None
Advanced > Parameter: pAppName of type String
Advanced > Prolog:
1
2
3
4
5
6
7
8
9
10

#****Begin: Generated Statements***


#****End: Generated Statements****
vCubeName = 'E-mail';
vIndex = 1;
# If number of recipient is changed in the Mailing_Details dimensions then change the below number accordingly
vEndIndex = 10;
vTo = '';

11
12
While (vIndex <= vEndIndex);
13
vRecipient = CellGetS (vCubeName, pAppName, 'Recipient ' | NumberToString (vIndex) );
14
If (vRecipient @<> '');
15
vTo = vTo | vRecipient | '; ';
16
EndIf;
17
vIndex = vIndex + 1;
18
End;
19
vTo = '"' | vTo | '"';
20
vFrom = '"' | CellGetS (vCubeName, pAppName, 'Sender') | '"';
21
vSubj = '"' | CellGetS (vCubeName, pAppName, 'Subject') | '"';
22
vBody = '"' | CellGetS (vCubeName, pAppName, 'Body') | '"';
23
vAttrProcess = '"' | AttrS ('Mailing_Applications', pAppName, 'TI_Process') | '"';
24
25
ExecuteCommand ('C:\WINDOWS\system32\cscript.exe TM1_PATH\Data\SendMailWithParameters.vbs ' | vFrom | ' ' | vTo | ' ' |
vSubj | ' ' | vBody | ' ' | vAttrProcess, 0) ;

Change the cube name in line #4, if you name it other than E-Mail
Change the end index number in line #8, if you increase/decrease number of recipients
In line #25, replace TM1_PATH with the actual path
Advanced > Epilog: None
Making it all work:
Now that we have the 3 pieces present and configured, we will make it work with a sample TI Process. From fig #4, we
will pick process BR_Load_Capital. This process loads CAPEX cube in our environment and it has to scheduled lets say
run every day at a certain time, 8 am.
Create a new process with this in the PROLOG:
1
2
3
4

#****Begin: Generated Statements***


#****End: Generated Statements****
vReturn = ExecuteProcess ( 'BR_Load_Capital');

5
6
7
8
9

If (vReturn <> ProcessExitNormal () );


ExecuteProcess ('Email Using Cube', 'pAppName', 'BR_Capital_Fail');
ElseIf (vReturn = ProcessExitNormal () );
ExecuteProcess ('Email Using Cube', 'pAppName', 'BR_Capital_Load');
EndIf;

Now create a chore based on this process, schedule and activate it. So every day at 8am, this chore is started and
variable vReturn captures the return code of the process execution. The process then sends out a success/failure e-mail
based on the return status.
Summary:
We created a cube (E-mail) that acts as data repository for various monitored processes. Then we created a TI process
(Email Using Cube) that accepts a parameter and sends e-mail based with the help of a VB script ( SendMailWithParameters.vbs).
You can modify these 3 objects to suit supplementary requirements such as include CC, BCC information, sending as
HTML/outlook rich format instead of plain text, increasing the priority of the e-mail etc.
Note:
This is tested on a 9.5.2 as well as 10.1 TM1 server installed on win 2008 R2 server and it is used in our
environment for over a year with outlook 2007
We are able to send e-mails within and outside the company (to yahoo, gmail etc)
VB script uses CDO object to send e-mail. If you are moving to Outlook 2010, although we have not tested it, we
are given to understand that this may not work right off the bat. See this Microsoft article for workaround
http://support.microsoft.com/kb/2028411/en-us

You might also like