How to use Current_Configuration() function to send job status for different environments
This document describes the steps for sending the Job status for different environments. This functionality was used in my previous project where the requirement was to send job notifications in DEV, UAT and PROD.
Data Services Version: 4.1 SP2
Pre-requisite: To achieve this functionality you need to create three different Datastore Configuration called DEV, UAT and PROD pointing to their respective environments.
**Please note that Code page is set to US-ASCII***. If this setting is changed then the job wont work properly
Solution: Below mention scripts need to be used
1) Upon failure the jobs sends out an email. Email address is set in the substitution parameter “$$MAIL_JOB_NAME”. Here is the script that sends the email
smtp_to($G_Email, ‘[$G_JOB_NAME]’ || ‘ failed in ‘ || current_configuration(‘Datastore_Name’), ‘[$G_JOB_NAME]’ || ‘ failed in ‘ || current_configuration(‘Datastore_NameI’), 10, 10);
The job takes the job name and the datastore current configuration (DEV/UAT/PRD) and uses that in the title and subject of the email.
2) Upon completion the job calls another script to send email notification.
smtp_to($G_Email, ‘[$G_JOB_NAME]’ || ‘ completed in ‘ || current_configuration(‘Datastore_Name’), ‘[$G_JOB_NAME]’ || ‘ completed successfully in ‘ || current_configuration(‘Datastore_Name’), 26, 0);
Please note that we need to assign the substitution parameter( $$MAIL_JOB_NAME) in to the $G_Email global parameter