Export Siebel Communication Templates using eScript

“Communication templates” – so boring a name for such an exciting thing that enables sending emails.

Siebel had communication templates as long as I can remember. Their function was simple and straight forward. Enable user/system to send emails as per a template.

You must have seen those freaky emails from large organizations that address you by your first name, initials, or even your very personal name that only your friends address you with?

Yep, Siebel can do that.


Did I just hear you ask how and where? Fear not – you just go to the record, let’s assume a Contact. Now, go to File menu > Send Email. Alternatively click F9.

siebel communication template send email


You can now select from email templates configured for the entity (in our case Contact). See the goodness of data getting auto populated from the Siebel record into the email draft.

siebel communication template auto populate email

Finalize the draft, and hit Send button to send the email on its way.

All this email magic starts from the email templates that you can configure in Siebel. You can create simple (or advanced) plain text, rich text, or HTML email templates in multiple languages.

siebel communication template administration

The email template capability is all good. But, for some strange reason Siebel does not provide an easy way to export/migrate these. Before Release 8, even using ADM meant you would have to create Content Object and what not just to get the migration to work.

For some reason if you are simply stuck in a pre-8 version, or if you are simply interested in exporting all the email templates, I can show you how.

We will use Siebel eScript to get this done.

Before we start though – take note of the quickest way to create/debug/test eScript. No, not by any fancy eScript framework – but using the plain, simple Client Business Service. Just create a new client service, start adding the code below, and within no time you can start testing every part of this script. To make things easier, you can create a custom function, and call that function from PreInvokeMethod thusly.

That aside, let’s focus on what needs to be done. All the logic that needs to be written will be in two functions.

The first one is ExportCommTemplate. This function will accept the following inputs:

  • SearchExpr – standard Siebel SearchExpr used to query for templates
  • Directory – Directory in which the template subdirectory should be created. Will default to c:\temp – note that this may be on server

An output will be nice. So, we will have some.

  • Status – message indicating status
  • # Comm Templates – no. of comm templates processed
  • # Comm Template Items – no. of comm template items processed
  • # Errors – no. of files that errored out!


First, declare variables and prepare for the fun.

We want to export all templates and store that in a directory that has a current date suffix.

The search expression helps to filter out templates that we need. If you are in doubt about how this whole thing works – introduce a blank search expression and provide the expression within the script itself. Replace the “1-ABC” with a specific row id of the template that can be tested.


Now, we just initiate the BO/BC and start the search.

We have the email template, and its time to get the details.


Simple email templates just have the field “Display Template Text” populated and that’s about it. But advanced templates are not that simple, they have elements in a child BC. So, if the current template is not a simple one we start collecting the details from the child BC.

CreateFile function uses CLIB function to create files with the specified name and content.

Since we may want to potentially reproduce the template in another environment, we are collecting all the details that we need to recreate the email template in its pristine condition. We will output all the details needed to the file name, and if there is an import later we can just extract all that is needed for the import.

Finally, we have to close the outer loop to navigate through all the templates found for the filter criteria. Also, don’t forget to set the output parameter values to the aggregate numbers that we found here.

The script does look complex, but is fairly simple in its doings.


You can download the full script here.


Leave a Reply

Notify of