First of all I must mention : EXCELLENT documentation on Sitecore documentation site.
I was on my first embarkation towards the xConnect world to implement a Subscription List that can be managed in the List Manager. I have not worked with xDB or xConnect any more than reading up on articles! This was my first hands-on encounter with xConnect. I thought I’d just capture the steps here for my personal reference in the future and more importantly this could help someone else who might be just getting on the xConnect train.
Make sure you have both xConnect Solr services running in Windows Services.
- Sitecore Marketing Automation Engine – MarketingAutomationService
- Sitecore xConnect Search Indexer – IndexWorker
If you intend to capture visit data for anonymous visitors of your site, you need to enable the indexing of anonymous contact. Here is the documentation on how to do that – https://doc.sitecore.net/developers/xp/xconnect/xconnect-search-indexer/enable-anonymous-contact-indexing.html
In short, you will be touching 2 files in your xConnect site –
In both these files you will need to change the following node to true.
Rebuild the index in Solr. Here is documentation for that: https://doc.sitecore.net/developers/xp/xconnect/xconnect-search-indexer/rebuild-index/rebuild-solr-index.html
In short, if you have the cores and all set up, you can just run the command in command window.
- Open a cmd window as administrator.
- Change directory to, <Drive>\<Your xConnect site root>\App_Data\jobs\continuous\Indexworker
Run this command
There are excellent sample code snippets on the documentation site. For example, implementing the code to add facets to your contacts. Here is very useful information about Contact facets: https://doc.sitecore.net/developers/xp/tracking-and-session/tracker/tracking-contacts/contact-facets/index.html
And sample code to add/update facets to contacts: https://doc.sitecore.net/developers/xp/tracking-and-session/tracker/tracking-contacts/contact-facets/update-facets.html
Remember one thing. Don’t just copy the code and expect it to work magically. It is called “Sample Code” for a reason. Here is an example of what I had to change –
contact = client.Get<Contact>(new
IdentifiedContactReference(anyIdentifier.Source, anyIdentifier.Identifier), new
var contact = client.Get<Contact>(new IdentifiedContactReference(anyIdentifier.Source, anyIdentifier.Identifier), new Sitecore.XConnect.ContactExpandOptions(PersonalInformation.DefaultFacetKey, ListSubscriptions.DefaultFacetKey, EmailAddressList.DefaultFacetKey));
When you load existing contacts, make sure to load them with whichever facets you need access to. Facets on contacts are not loaded automagically!
Well, nothing happens without any issues. But that’s for a later date…when I am actually able to resolve them. 🙂