Skip to content
Snippets Groups Projects
Commit f9e1c287 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch 'm_mg_1080212_webview_placeholder' into '2021.0.3'

[Projekt: xRM-Marketing][TicketNr.: 1080212][Webview / View in browser Platzhalter]

See merge request xrm/basic!919
parents 0847d364 0fcaba27
No related branches found
No related tags found
No related merge requests found
......@@ -142,10 +142,18 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun)
return new Placeholder(placeholder, Placeholder.types.FIXEDVALUE, url);
});
var webviewFn = function(pContactId)
{
return vars.get("$sys.origin")+"/services/rest/webview_rest?" + "log=" + mailLogIds.get(pContactId);
}
var webviewPlaceholder = new Placeholder("webview", Placeholder.types.CALLBACKFUNCTION, webviewFn);
var additionalPlaceholders = [webviewPlaceholder].concat(linkPlaceholders);
var successIds = [];
var failedIds = [];
var sentDate = vars.get("$sys.date");
var mails = template.getReplacedEmailsByContactIds(contactIds, linkPlaceholders);
var mails = template.getReplacedEmailsByContactIds(contactIds, additionalPlaceholders);
var subjectTemplate = new DocumentTemplate(subject, DocumentTemplate.types.PLAIN);
var subjects = subjectTemplate.getReplacedContentByContactIds(contactIds);
......
import("Email_lib");
import("Sql_lib");
import("Workflow_lib");
import("Util_lib");
import("system.util");
import("Bulkmail_lib");
function restget (pRequest)
{
var request = JSON.parse(pRequest);
var mailLogId = request.query.log;
if (mailLogId)
{
try
{
var BulkMailId,MailRunId;
[BulkMailId,MailRunId] = newSelect(["MAIL_RUN.OBJECT_ROWID","MAIL_RUN.MAIL_RUNID"])
.from("MAIL_LOG")
.join("MAIL_RUN","MAIL_RUN.MAIL_RUNID = MAIL_LOG.MAIL_RUN_ID")
.where("MAIL_LOG.MAIL_LOGID",mailLogId)
.arrayRow();
var eml = BulkMailUtils.getEmlFile(BulkMailId, MailRunId, mailLogId);
var email = Email.fromRFC(eml);
request.response.httpStatusCode = 200; //Ok
request.response.header["Content-Type"] = "text/html";
request.response.body = email.body;
}
catch (ex)
{
request.response.httpStatusCode = 404; //not found
}
}
else
{
request.response.httpStatusCode = 400; //bad request
}
return JSON.stringify(request);
}
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>webview_rest</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/webview_rest/process.js</process>
<publishAsWebservice v="true" />
<style>REST</style>
<loginTypeId>
<element>internal.none</element>
</loginTypeId>
<alias>Data_alias</alias>
<variants>
<element>EXECUTABLE</element>
</variants>
</process>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment