1

I have created few profile/pattern cards and assigned to persona. Where are these cards stored, is it in MongoDB OR SQL database?

User visit journey reaches the persona, Now I want to retrieve all the Pattern / Profile Card names into JSON format, please suggest the best approach.

3

The Profile and Pattern Cards are all stored in the Sitecore SQL Databases (master and web) so you can get the list of Patterns or Profile Cards for a given Profile via the Sitecore API.

Profiles are stored under /sitecore/system/Marketing Control Panel/Profiles and each Profile has its own set of Profile and Pattern Cards. When you have the Items they can be cast to their respective Types with constructors or Create methods.

Profile: Sitecore.Analytics.Data.Items.ProfileItem

// cast Sitecore Item to Profile
var profile = new ProfileItem(item);

Profile Card: Sitecore.Analytics.Data.Items.ProfileCardItem

// get profile cards from a profile item
var profileCards = profile.ProfileCards;

// cast Sitecore Item to Profile Card
var profileCard = ProfileCardItem.Create(item);

Pattern Card: Sitecore.Analytics.Data.Items.PatternCardItem

// get pattern cards from a profile item
var patternCards = profile.Patterns;

// cast Sitecore Item to Pattern Card
var patternCard= PatternCardItem.Create(item);

Converting C# objects to json: Libraries are available to help with this. A popular one is Newtonsoft.Json which is available via NuGet: https://www.nuget.org/packages/Newtonsoft.Json/

var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(profileCardsObject);

It may be a good idea to select these objects into custom objects with only the properties you want in the resulting json object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.