EXM 8.1:根据特定 Sitecore 角色的成员创建收件人列表的简便方法?

EXM 8.1: Easy way to create a recipient list based on members of a certain Sitecore role?

问: 是否有 "out of the box" 技巧可以根据来自的成员为 Email Experience Manager 创建新的收件人列表某个 Sitecore 角色?

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

基于这篇文章:http://blog.boro2g.co.uk/sitecore-export-users-role/ 一个选项是从 "Members in role" 导出到 CSV,然后将其导入回 EXM 的 xDB。

可以通过扩展列表管理器的条件来完成: 假设您将 Analytics DB 从 DMS 转换为 8 成功,并且您拥有与之前的访问者用户相对应的联系人用户。您可以创建 "Segmented list" 个对应某些角色的联系人。对于细分 table,您应该创建新的自定义条件来过滤您的联系人。 (逻辑可能很简单:你知道联系电子邮件,然后你通过这个电子邮件找到用户并检查他的角色)。

首先,您需要将用户角色字段添加到您在 sitecore_analytics_index 中的联系人中。为此,您应该将新的计算字段添加到 Sitecore.ContentSearch.Lucene.Index.Analytics.config<fields hint="raw:AddComputedIndexField"> 部分(我假设您使用的是 Lucene)。

示例如下:

<field fieldName="Contact.ProfileProperties.UserRole" emptyString="_EMPTY_" nullValue="_NULL_" storageType="YES" indexType="UNTOKENIZED">Your.Type.Name, Your.Assembly</field>

您的类型应该通过 id 获取索引用户的角色。

之后,将名为 "UserRole" 的新条件添加到 /sitecore/system/Settings/Rules/Definitions/Elements/Segment Builder,其中字段 "Text" 为:

where the userrole [operatorid,StringOperator,,compares to] [value,,,specific userrole]

并且 "Type" 指向您的自定义 class,如下所示:

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);

    }
}

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