Archiving an email in SuperOffice created by a CRM Script

lock
push_pin
done
Besvart
2

Hi,

I am sending an email from SuperOffice via a CRM Script (pretty basic code below, but in my full code I am also using reply templates, and the parser variables).

//Send Email
Email email;
email.setValue("to", toEmailAddress);
email.setValue("subject", subject);
email.setValue("bodyHtml", bodyHtml);
email.send();

I now want to archive that email in SuperOffice, so that it looks like a standard SuperOffice archived email, I.E. I can see values in the email to field, email subject, and email body.

At this point, I cannot even seem to set the email body, with the code I have below not working (based on the AI results produced from SuperOffice Docs).

NSDocumentAgent agent;
NSDocumentEntity doc = agent.CreateDefaultDocumentEntity();

// set properties (name, contact, etc.) on doc

//Set Document Template
NSDocumentTemplate docTmpl;
docTmpl.SetDocumentTemplateId(154);
doc.SetDocumentTemplate(docTmpl);

//Set Document Heading
doc.SetHeader("Demo");

//Set Document Filename
doc.SetName("POC " + getCurrentDateTime().toString("YY2MM2DD2HH24MI2SS2") + ".somail");

//Save Document
doc = agent.SaveDocumentEntity(doc);

NSStream stream;
stream.SetStream(bodyHtml.toByteArray());
doc = agent.SetDocumentStream(doc, stream, true);

The code does not error when I run it, but I do then get an error when trying to open the archived email that the CRMScript has created.  I haven't even got to the point of looking to set the email to address and subject.

Is it possible to archive an email via CRMScript that was created using the Email agent?

Many thanks,

Trevor

 

19. okt. 2026 | 03:03 p.m.

Alle Svar (2)

Hi Tony,

Not possible today by anything build-in, the EmailAgent isn't accessible from CRMScript/External apps, and CRMScript does not have any build in way to get a valid rfc822/eml formatted variant of the e-mail message you sent using the email class.

19. okt. 2026 | 04:52 p.m.

Thanks for confirming this, hopefully this is something the developers will add to CRMScript, as I would imagine that this is something that would be quite useful for other customers as well.

Thanks again for your help,

Trevor

19. okt. 2026 | 05:14 p.m.

If you can add a BCC receipient to your email, and that mail would end up in a dedicated mailbox, then DataBridge is able to pick up that email and archive it in SuperOffice as EML. It can pick details from the To/CC/From or the subject or body of the email to archive it to the relevant company, contact, project and sale.

Hope this helps. Let me know if you need some guidance on how to do that or for demo access to DataBridge.

9 t, 32 m siden | 02:11 p.m.

Legg til svar