我正在尝试使用Logic Apps在Dynamics 365中创建电子邮件实体。 我正在填写发件人和收件人字段,但是当我检查在Dynamics中创建的记录时,我看到这些字段为空。我知道来自和来自字段的是Dynamics 365电子邮件实体中的活动方。我们是否有一个示例json,我可以在Logic Apps中使用它来创建一个带有To和From字段的电子邮件活动?
答案 0 :(得分:1)
根据产品组,目前无法从逻辑应用创建和设置电子邮件实体的字段
答案 1 :(得分:0)
抱歉,无法访问笔记本电脑时回答。这对你来说不是直截了当的答案。但只是一个开始构建自己的请求Json对象。
在以下代码段中替换您的记录指南在浏览器控制台或CRM js Web资源中执行此操作。最后选择JSON.stringify(email)
&这就是你正在寻找的东西。
var serverURL = Xrm.Page.context.getClientUrl();
var email = {};
email["subject"] = "Email Subject";
email["description"] = "email body description";
email["regardingobjectid_contact@odata.bind"] = "/contacts(guid1)";
//activityparty collection
var activityparties = [];
//from party
var from = {};
from["partyid_systemuser@odata.bind"] = "/systemusers(guid2)";
from["participationtypemask"] = 1;
//to party
var to = {};
to["partyid_contact@odata.bind"] = "/contacts(guid3)";
to["participationtypemask"] = 2;
activityparties.push(to);
activityparties.push(from);
//set to and from to email
email["email_activity_parties"] = activityparties;
var req = new XMLHttpRequest();
req.open("POST", serverURL + "/api/data/v8.0/emails", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Prefer", "return=representation");
req.onreadystatechange = function() {
if (this.readyState == 4 /* complete */ ) {
req.onreadystatechange = null;
if (this.status == 201) {
var emailUri = this.getResponseHeader("OData-EntityId");
}
else {
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send(JSON.stringify(email));
}
如果您需要,请参考此blog。