Apr 27, 2012

Oracle EBS Alert - Basics


Idea of this post is to create a simple alert and test if it is working or not.
Just for example, assume a requirement to send Happy birthday mail to employees in an organization.

As you might already know by now, there are 2 kinds of alerts in oracle apps.
Periodic Alerts and Event based Alerts.
You are correct, we have to choose Periodic alert for our requirement.

Employee Birthday can be any calendar day of the year. So we will tell oracle apps 
to check daily once every calender day and see if today is employee's birthday and send email if true.

You need Alert Manager Responsibility to define a new Alert.
Navigate through Alert Manager -> Alert -> Define
Fill the options as given in the screenshot below.

Note that we need to write SQL which satisfies our condition and also to fetch required details. Here is the SQL

select global_name, date_of_birth, email_address
into &emp_name, &dob, &emp_email
from per_all_people_f
where trunc(sysdate) between effective_start_date and effective_end_date
AND to_char(to_date(date_of_birth),'dd') = to_char(to_date(sysdate),'dd')
AND to_char(to_date(date_of_birth),'mm') = to_char(to_date(sysdate),'mm');




You can check the SQL for syntax using "verify" button.

One point here, if any row that matches condition, it is called exception in Alert.
So when you click "run" button, it will display the number of exceptions occured (number of rows that satisfied the condition).

Next step is to define action if condition matches. Don't forget to select action level of type "Detail". This is because action should be performed once for every Alert Exception.



Then click on "Action Details" button and define the email message as shown below.
Note the fields highlighted in orange are the alias names that are defined in query (INTO clause). Oracle Alert will dynamically replace these aliases with the actual values at run time. The one highlighted in green is the hard coded constant "Reply to" email address.




That's not enough, we also need "Action Sets" and attach the action which we just created. Just follow the screenshots to do that.





Now comes the question, how do we test this Alert?

Go to Alert Manager -> Request -> Check, and schedule the Alert to run it sometime after current time.
It will submit a concurrent program. [In this example CP Name is "Birthday Wishes E-mail Alert (Check Periodic Alert)"]



Once concurrent program is successfully ran, the number of exceptions can be verified from Alert Manager -> History and query for alert. Here exceptions mean, the number of records that matched the SQL query and to be processed by Alert Engine.




Which means our Alert is working.
Note that you can do many more than just sending mails. Alert can execute SQL code/function/procedures and it can also run concurrent programs.
So why wait, go ahead and explore more. :-)

12 comments:

  1. Excellent Post...... Thanks.

    ReplyDelete
  2. Thanks. Excellent post. How do we define email address??
    Masood

    ReplyDelete
  3. Thanks. Excellent post. How do we define email address so that alert directly sends email to one who,s having birthday...???
    Mirza

    ReplyDelete
    Replies
    1. Thanks Mirza/Massod, I have added a new screenshot to the above post to answer your question.

      Delete
    2. screenshot is missing...Please attach the same...Thank you

      Delete
    3. Thanks Soumya for reading my blog. Please check for screenshot now.

      Delete
  4. Excellent post. Thank you

    ReplyDelete
  5. HI.. how can we run it everyday at specific time without manual run?

    ReplyDelete
    Replies
    1. As shown in the first screenshot in this post. You have to use the option, Frequency - every N days/Calendar days and select 1 days to run the alert every day. Hope that helps...

      Delete