I have created an Automation Plan and its enrollment is based on Custom Page Event.
The Plan is working as expected, but the contacts are not multiple-enrolled. Meaning that if the contact already in the plan, it will not enter it again until it exits.
In my case I want the contact to be enrolled again even if it's currently enrolled.
As per the documentation https://doc.sitecore.com/developers/93/sitecore-experience-platform/en/automation-plans.html I will need to Implement ContextKeyFactoryType to get unique enrollment key in order to allow multiple reentry.
The requirement is to get this key from custom contact facet which is being updated every week to allow the contact to be enrolled again in the plan once per week even if the custom Page Event raised more than once in the same week.
Now the GenerateKey (please see the snippet below) passes only the contactId and I want to load the contact and access its facets.
I have tried Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient() but it's not available in the Marketing Automation context.
public class ContextKeyFactoryProvider : IContextKeyFactory
{
public string GenerateKey(Guid contactId, ExecutionData executionData)
{
string str;
/* Get XConnect Client to load the contact by contactId and access facets */
return str;
}
}
Note: I don't want to enroll the contact to the automation plan programmatically, and thus I will not be able to define ExecutionData CustomValues