Skip to main content
Community site session details

Community site session details

Session Id :

Email Vorlage automatisch auswählen

Michael Sulz Profile Picture Michael Sulz 790

Ich habe schon mehrfach in den Foren die Frage gelesen, wie eine Email Vorlage automatisch ausgewählt werden kann. In diesem Forumbeitrag habe ich jetzt eine entsprechende Lösung gelesen, die ich euch nicht vorenthalten möchte.

function setEmailContent() {
try {
//Nur bei Create
if (crmForm.FormType == 1) {
var command = new RemoteCommand("EmailTemplateService", "GetInstantiatedEmailTemplate");
command.SetParameter("templateId", "{47A39EA6-388F-43B9-9880-E1FDB88B3A5D}");
command.SetParameter("objectId", ticket.DataValue[0].id);
command.SetParameter("objectTypeCode", 112);


var result = command.Execute();
//Wenn eine entsprechende Vorlage gefunden wurde
if (result.Success) {
if (typeof (result.ReturnValue) == "string") {
var oXml = CreateXmlDocument(false);
oXml.loadXML(result.ReturnValue);
crmForm.all.description.InsertValue(oXml.selectSingleNode("template/body").text);
crmForm.all.subject.value = oXml.selectSingleNode("template/subject").text;
}
}
}
return true;
}
catch (e) {
alert("Error : " + e.description);
return false;
}
}



This was originally posted here.

Comments

*This post is locked for comments