Sitecore Marketing Automation API defines how to enroll a contact in a plan, but doesn't mention how to get plans that current (or specified) contact is enrolled in. Is there an API for that? Sitecore version 9.1.

  • What version of Sitecore
    – Chris Auer
    Feb 12, 2019 at 13:42

2 Answers 2


The plans a contact is enrolled in is stored in a built-in facet on the contact called AutomationPlanEnrollmentCache.

You can get the facet like this:

using (XConnectClient client = SitecoreXConnectClientConfiguration.GetClient())
    var contact = client.Get(
        new IdentifiedContactReference("Your Known ID Type", "Your Contact ID"),
        new ContactExpandOptions(AutomationPlanEnrollmentCache.DefaultFacetKey));
    var enrollmentCacheFacet = contact.GetFacet<AutomationPlanEnrollmentCache>(

The facet contains a list of all plans the user is enrolled in. The AutomationPlanDefinitionId is the ID of the plan.

enter image description here

I'm guessing that ActivityId defines which element in the plan the user is currently at, but I haven't done enough research into that to actually confirm this. The other properties on the facet should be self-explanatory :)


In older Sitecore versions this code used to work:

AutomationStateManager manager = Tracker.Current.Session.CreateAutomationStateManager();
var plans = manager.GetAutomationStates().Select(s => s.PlanItem);

I'm not sure if it still work in the latest but it should be a good place to start.

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.