Share

Using Batch Workflow Policies For Sending Consolidated Emails

You might have heard about Batch Mode flag or noticed while working on workflow policies.

batch mode

What is that? Key difference between batch and usual policies is that BWP (Batch workflow policy) works directly on data tables instead of using usual infrastructure comprising triggers and S_ESCL_REQ table. BWP evaluates more data in database, not just the records that fired WP triggers. This is usefull when you have to run your new policy over existing data.

Other interest feature of batch mode is consolidated mails. Let me explain what is it.

Siebel has a set of tools for sending email messages. They are often used to notify users about different events in application. However if a user involved in many business processes with many notifications Siebel starts to spamming this man.

For example sales department manager wants to know how many opportunities has been lost for last week. We can solve this requirement by creating respective workflow policy with action based on Send Message program type. This means that with every lost opportunity Siebel will send an email to manager with notification. And if there were 30 opties lost the manager will receive 30 emails. More convenient way is to send a single message with list of all lost opportunities instead of spamming the manager. That message called consolidated mail.

Wokflow Monitor can’t do consolidation itself. Instead it passes requests to another server component – Action Agent which looks for the same events and the same address, combine this events and pass a single request to Email Manager – one more server component that is used to sending emails.

In theory it looks like this

  1. Workflow Monitor started in Batch mode check the database for all records records complying policy conditions
  2. For every record that complies condition workflow monitor passes a request to Workflow Action Agent (creating record in S_ESCL_ACTN_REQ table).
  3. Workflow Action Agent checks S_ESCL_ACTN_REQ table. If there are requests marked with consolidated flag intended for a single receiver, it combines them into a single message and pass it to Email Manager (creating record in S_APSRVR_REQ table).
  4. Email Manager server component checks S_APSRVR_REQ and passes request to corresponding business service

Let’s try to do that.

Suppose that we want to send weekly email to specified position with list of all lost opportunities (as it described above).

As a prerequisite you have to configure your communications management infrastructure so it can be used to sending emails. Also make sure that the following Siebel Server components are activated and available on your Siebel Server:

  • Workflow Monitor Agent
  • Workflow Action Agent
  • Email Manager

Also you should be familiar with srvrmgr utility.

1. Create workflow policy action. Provide following parameters

Name: Action name (anything you wish)

Program: there is predefined program for sending opportunity mails. That is Send Opportunity Email.

In Send Message Arguments we can provide desirable email parameters.

Subject: email subject

Message Template: all equal events with the same recipient will be combined in a single mail. Message Template is the first part of email. You can use field values from available field substitutions.

Repeating Message: second and subsequent parts of email. Again you can use field values from available field substitutions.

In recipients list we should provide list of employees/positions/contacts/addresses/something else who will receive our notification. In our case that is probably Send to Position with Sales Department Manager value (or any other position according to your organization structure)

batch mode1

2. Create new workflow policy.

Provide Name, Policy Group, Workflow Object and don’t forget to set Batch mode flag.

Set following conditions:

Opportunity Stage = 09 – Closed/Lost Закрыта/Отказ

Opportunity Component > Current – 7:0:0

This means that we only interested in opties in 09 – Closed/Lost stage and that have been last modified no more than 7 days ago. This is actually not a precise criteria but you can change it according to your requirenments.

Add previously created action. Set Consolidate flag: this show Action Agent that you want to have a single consolidated message.

batch mode2

As we work in batch mode without using triggers we don’t need to generate them.

Now everything is ready and we can start our components.

Run srvrmgr and start task for Workflow Monitor with following parameters

start task for comp WorkMon with BatchMode=”TRUE”,GroupName=”Mail Notification Group”,ActionAgent=”TRUE”

This command is used for starting a task for Workflow Monitor server component working in batch mode (BatchMode parameter) using Action Agent (ActionAgent parameter) to process policies from Mail Notification Group (GroupName parameter).

After completing the task we can see that there are several records in S_ESCL_ACTN_REQ (of course if you have opties lost in previous week). That are requests to Action Agent.

Now let’s start our Action Agent to process all this requests.

start task for comp WorkActn with GroupName=”Mail Notification Group”

After first iteration of Action Agent we can see that S_ESCL_ACTN_REQ is empty, but there is new record in S_APSRVR_REQ which is a request to Email Manager.

Finish our work by running Mail manager with following command

start task for comp mailmgr with SleepTime=60

If everything is ok request in S_APSRVR_REQ should become SUCCEEDED.

3 comments on “Using Batch Workflow Policies For Sending Consolidated Emails”

  1. Naga Reply

    I have one question here…
    We have set duration for 1 week ,in case if siebel server get bounced in between days…Still do we get previous created opportunities in next email?or do we lost entries in S_ESCl_ACTN-REQ?

Leave A Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!