Skip to main content

HTML report

Header

Level: Jedi Knight/Jedi Master

Keywords: template example, messaging, attachment, temporary files

The result: Examples of templating and snippets of code for creating final report

You can make a HTML template which can be used as a body of a message.

template - example
<#assign title = "Decision"/>
<#assign titleClass = "info"/>
<#include "_header.html"/>

<h2>New decision has been received</h2>

Good morning,</br>
decision type: <b>${decisionType}</b>was sent from public portal.
</br>
</br>
Decision was sent from e-mail address ${sender}.

<#include "_footer.html"/>
business action for messaging - example
function action(context) {
var feature = api.features()
.prepareGetFeature(context)
.entityType("ft_boTestSamo")
.entityId("326655109063374479349456773600")
.get();

api.messages()
.prepareSendEmail(context)
.sender("no-reply@asseco-ce.com")
.addRecipient("martin.mares@asseco-ce.com")
.subject("test")
.templateGroup("test")
.template("testEmailTemplate")
.model(feature)
.prepareFeatureAttachment()
.attachmentId("677369054072634552295904")
.attach()
.prepareFileAttachment()
.templateGroup("test")
.template("testWordTemplate")
.model(feature)
.name("testAttachment.pdf")
.outputType("pdf")
.attach()
.prepareEntityAttachment()
.entityType(feature.type)
.entityId(feature.id)
.attach()
.send();

/*
api.messages()
.prepareSendSMS()
.addRecipient("+420xxxxxxxxx")
.send();
*/

api.messages()
.prepareSendMessage(context)
.source("martin.mares@asseco-ce.com")
.subject("test")
.templateGroup("test")
.template("testEmailTemplate")
.briefTemplate("testBriefTemplate")
.model(feature)
.prepareAddTarget()
.recipientType("user")
.recipient("martin.mares")
.addDefaultChannel("message")
.addDefaultChannel("email")
.add()
.prepareAddTarget()
.recipientType("group")
.recipient("SAMO-Operators")
.addDefaultChannel("message")
.addMandatoryChannel("email")
.add()
//.addLabel("portal")
.send();

api.messages()
.prepareSendMessage(context)
.source("martin.mares@asseco-ce.com")
.subject("test")
.plainBody("<b>test</b>")
.prepareAddTarget()
.recipientType("user")
.recipient("martin.mares")
.addDefaultChannel("message")
.addDefaultChannel("email")
.add()
.send();
}