In short: how can I send an email using Siebel's Comm Outbound Email
buscomp, when the email body is longer than 40.960 characters? I can use the Outbound Communications Manager
BS instead (or another one), but I need the activity record to be created too.
In Siebel 7.8 you can send emails in a few different ways:
Pressing F9 opens the Send Communications Applet
, where the Send button invokes the underlying BC Comm Outbound Email
→ EmailSend
method: the email is sent and a new activity record is created (S_EVT_ACT
and S_EVT_MAIL
tables). There is no length limit for the email body.
From server script, you can use the Outbound Communications Manager
service method SendMessage
. It doesn't have length limitations either, but it doesn't create any record in Siebel BCs, it just sends the message without leaving any trace.
var psOut:PropertySet = TheApplication().NewPropertySet();
var psIn:PropertySet = TheApplication().NewPropertySet();
psIn.SetProperty("ProcessMode", "Remote");
psIn.SetProperty("Charset", "iso-8859-1");
psIn.SetProperty("CommProfile", from);
psIn.SetProperty("MsgToList", to);
psIn.SetProperty("MsgSubject", subject);
psIn.SetProperty("MsgHTMLBody", body);
var bs:Service = TheApplication().GetService("Outbound Communications Manager");
bs.InvokeMethod("SendMessage", psIn, psOut);
EmailSend
method. The problem is that you can't set a Display Email Body
value longer than 40.960 characters, otherwise you get a SBL-DAT-00235
error.var bo:BusObject = TheApplication().GetBusObject("Service Request");
var bc:BusComp = bo.GetBusComp("Comm Outbound Email");
bc.NewRecord(NewAfter);
bc.SetFieldValue("Email Format", "HTML/Plain Text");
bc.SetFieldValue("Email Charset", "iso-8859-1");
bc.SetFieldValue("Email Sender Address", from);
bc.SetFieldValue("Email Sender Name", from);
bc.SetFieldValue("Email To Line", to);
bc.SetFieldValue("Description", subject);
bc.SetFieldValue("Display Email Body", body); // will fail if body.length > 40960
bc.WriteRecord();
bc.InvokeMethod("EmailSend");
Why am I restricted to 40.960 characters (and where did that number come from?) in the Display Email Body
, while the F9 applet doesn't have that limitation? I know that field is special; for starters, Siebel 7.8 doesn't support database columns above 16.383 characters, yet this field max length is 1.024.000 (not 40.960...). For that, the field user property Text Length Override
is defined (without value). Also, it isn't mapped to any column: it's a calculated field, but without calculated expression; I guess the BC's CSSBCOutMail
class manages it. But still, it should be the same whether I'm using it from scripting or from an applet. Why isn't it, should I change anything anywhere to enable it?
My requeriment is to send long emails from a server script, but I need the activity record to be created too. Is there any hidden parameter that I can set when calling Outbound Communications Manager
→ SendMessage
, in order to create the activity record? Or any way to avoid the error if I do bc.SetFieldValue("Display Email Body", aVeryLongEmailBody);
?
I found this document (1676136.1) in the Oracle support web, which answers a similar question:
Customer is using Outbound Communications Manager business service method SendMessage to send emails out from a workflow and want to keep an activity record or have a view where they can see the email that were sent out using this method.
The workaround they offer is the same we were using: to create the activity record using the Comm Outbound Email
BC. But instead of doing it directly with a NewRecord and a bunch of SetFieldValues, they use the Inbound E-mail Database Operations
business service:
var psOut:PropertySet = TheApplication().NewPropertySet();
var psIn:PropertySet = TheApplication().NewPropertySet();
psIn.SetProperty("BusObj", "Mail Agent Activity");
psIn.SetProperty("BusComp", "Comm Outbound Email");
psIn.SetProperty("Field: Description", subject);
psIn.SetProperty("Field: Display Email Body", body);
psIn.SetProperty("Field: Email Sender Address", fromAddress);
psIn.SetProperty("Field: Email Sender Name", fromProfile);
psIn.SetProperty("Field: Email To Line", toAddress);
var bs:Service = TheApplication().GetService("Inbound E-mail Database Operations");
bs.InvokeMethod("InsertRecord", psIn, psOut);
var error = psOut.GetProperty("ErrorMessage"); // "" if everything went ok
var actId = psOut.GetProperty("ID");
Doing so avoids the weird 40960 characters limitation.
In case anybody needs it, apparently there is also a UpdateRecord
method, but it's hidden in the BS definition. The parameters are similar: BusObj
and BusComp
, Id
(the row id of the record you want to update), and a Field: Name Of The Field
for each field you want to change.