How can I send long emails in Siebel server script?
<p><strong>In short</strong>: how can I send an email using Siebel's <code>Comm Outbound Email</code> buscomp, when the email body is longer than 40.960 characters? I can use the <code>Outbound Communications Manager</code> BS instead (or another one), but I need the activity record to be created too.</p>

<hr>

<p>In Siebel 7.8 you can send emails in a few different ways:</p>

<ol>
<li><p>Pressing <kbd>F9</kbd> opens the <code>Send Communications Applet</code>, where the <kbd>Send</kbd> button invokes the underlying BC <code>Comm Outbound Email</code> &rarr; <code>EmailSend</code> method: the email is sent and a new activity record is created (<code>S_EVT_ACT</code> and <code>S_EVT_MAIL</code> tables). There is no length limit for the email body.</p></li>
<li><p>From server script, you can use the <a href="https://docs.oracle.com/cd/B31104_02/books/CommSrvAdm/CommSrvAdm_BusServ8.html#wp1042984" rel="nofollow"><code>Outbound Communications Manager</code> service method <code>SendMessage</code></a>. It doesn't have length limitations either, but <strong>it doesn't create any record in Siebel BCs</strong>, it just sends the message without leaving any trace.</p></li>
</ol>



<pre class="lang-js prettyprint-override"><code>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);
</code></pre>

<ol start="3">
<li>Or you can replicate the F9 behaviour by creating the BC record yourself and invoking the (undocumented?) <code>EmailSend</code> method. The problem is that you <strong>can't set a <code>Display Email Body</code> value longer than 40.960</strong> characters, otherwise you get a <code>SBL-DAT-00235</code> error.</li>
</ol>

<pre class="lang-js prettyprint-override"><code>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 &gt; 40960
bc.WriteRecord();
bc.InvokeMethod("EmailSend");
</code></pre>

<p>Why am I restricted to 40.960 characters (<em>and where did that number come from?</em>) in the <code>Display Email Body</code>, while the F9 applet doesn't have that limitation? I know that field is special; for starters, <a href="https://docs.oracle.com/cd/B31104_02/books/ConfigApps/ConfigApps_TablesColumns21.html" rel="nofollow">Siebel 7.8 doesn't support database columns above 16.383 characters</a>, yet this field max length is 1.024.000 (not 40.960...). For that, the <a href="https://docs.oracle.com/cd/B31104_02/books/ToolsDevRef/ToolsDevRef_UserProps173.html" rel="nofollow">field user property <code>Text Length Override</code></a> 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 <code>CSSBCOutMail</code> 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?</p>

<p>My requeriment is to <strong>send long emails from a server script, but I need the activity record to be created too</strong>. Is there any hidden parameter that I can set when calling <code>Outbound Communications Manager</code> &rarr; <code>SendMessage</code>, in order to create the activity record? Or any way to avoid the error if I do <code>bc.SetFieldValue("Display Email Body", aVeryLongEmailBody);</code>?</p>