EXM 8.1:基于特定Sitecore角色的成员创建收件人列表的简单方法?

EXM 8.1:基于特定Sitecore角色的成员创建收件人列表的简单方法?,sitecore,sitecore8,sitecore-ecm,sitecore-exm,Sitecore,Sitecore8,Sitecore Ecm,Sitecore Exm,Q:是否有一种“开箱即用”的技巧,可以根据某个Sitecore角色的成员为电子邮件体验管理器创建新的收件人列表 我做了一些研究,EXM(ECM)中的ListManager只允许导入CSV文件,而不与Sitecore UserManager模块集成 基于本文:一个选项是实现从“角色中的成员”导出到CSV,并将其导入到EXM的xDB中。可以通过扩展列表管理器的条件来完成: 假设您成功地将Analytics DB从DMS转换为8,并且您的联系人用户与之前的访客用户对应。您可以创建联系人的“分段列表”,

Q:是否有一种“开箱即用”的技巧,可以根据某个Sitecore角色的成员为电子邮件体验管理器创建新的收件人列表

我做了一些研究,EXM(ECM)中的ListManager只允许导入CSV文件,而不与Sitecore UserManager模块集成


基于本文:一个选项是实现从“角色中的成员”导出到CSV,并将其导入到EXM的xDB中。

可以通过扩展列表管理器的条件来完成:
假设您成功地将Analytics DB从DMS转换为8,并且您的联系人用户与之前的访客用户对应。您可以创建联系人的“分段列表”,该列表将对应于某些角色。对于分段表,您应该创建新的自定义条件以过滤联系人。(逻辑可能很简单:您知道联系电子邮件,然后通过此电子邮件找到用户并检查其角色)

首先,您需要将用户角色字段添加到sitecore\u analytics\u索引中的联系人中。为此,您应该在
Sitecore.ContentSearch.Lucene.Index.Analytics.config
部分添加一个新的计算字段(我假设您使用的是Lucene)

以下是示例:

<field fieldName="Contact.ProfileProperties.UserRole" emptyString="_EMPTY_" nullValue="_NULL_" storageType="YES" indexType="UNTOKENIZED">Your.Type.Name, Your.Assembly</field>
“Type”指向您的自定义类,如下所示:

public class UserRoleCondition<T> : TypedQueryableStringOperatorCondition<T, IndexedContact> where T : VisitorRuleContext<IndexedContact>
{
    protected override Expression<Func<IndexedContact, bool>> GetResultPredicate(T ruleContext)
    {
        var userrole = this.Value ?? string.Empty;

        return
            this.GetCompareExpression(
                c => (string)c[(ObjectIndexerKey)"contact.profileproperties.userrole"], userrole);

    }
}
公共类UserRoleCondition:TypedQueryableStringOperator条件,其中T:VisitorRuleContext
{
受保护的重写表达式GetResultPredicate(T ruleContext)
{
var userrole=this.Value??string.Empty;
返回
this.getCompareeExpression(
c=>(字符串)c[(ObjectIndexerKey)“contact.profileproperties.userrole”],userrole);
}
}

现在,您可以在分段列表的分段中使用新的用户角色条件

谢谢安东,你的回答很有用!谢谢你的解决方案,非常有帮助!当做
public class UserRoleCondition<T> : TypedQueryableStringOperatorCondition<T, IndexedContact> where T : VisitorRuleContext<IndexedContact>
{
    protected override Expression<Func<IndexedContact, bool>> GetResultPredicate(T ruleContext)
    {
        var userrole = this.Value ?? string.Empty;

        return
            this.GetCompareExpression(
                c => (string)c[(ObjectIndexerKey)"contact.profileproperties.userrole"], userrole);

    }
}