3
votes

Q: Is there an "out of the box" trick to create a new recipient list for Email Experience Manager based on members from a certain Sitecore role?

I did some research and the ListManager in EXM (ECM) only allows importing contact a CSV file, without integrating with the Sitecore UserManager module.

Based on this article: http://blog.boro2g.co.uk/sitecore-export-users-role/ an option would be to implement an Export to CSV from the "Members in role" and import that back in EXM's xDB.

2

2 Answers

1
votes

It could be done with an extension of conditions for List Manager: Supposed that your conversion of Analytics DB from DMS to 8 was successful and you have contacts-user that corresponds your visitors-users previously. You can create "Segmented list" of contacts which will correspond some role. For segmentation table you should create new custom condition that will filter your contacts. (Logic could be easy enough: you know contact email, then you find user by this email and check his roles).

3
votes

First you need to add the User Role field to your contacts in sitecore_analytics_index. In order to do that you should add a new Computed Field into <fields hint="raw:AddComputedIndexField"> section of Sitecore.ContentSearch.Lucene.Index.Analytics.config (I assume you're using Lucene).

Here's example:

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

Your type should get the role of the indexed user by id.

After that add a new condition named "UserRole" to /sitecore/system/Settings/Rules/Definitions/Elements/Segment Builder where field "Text" would be:

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

And the "Type" points to your custom class, like the following:

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

    }
}

Now you're able to use the new User Role condition in segmentation for your Segmented List.