public List <string> LoadEngagementStates() { List <string> states = new List <string>(); try { var engagementstates = AutomationStateManager.Create(Tracker.Current.Contact).GetAutomationStates(); if (engagementstates.Any()) { foreach ( AutomationStateContext context in AutomationStateManager.Create(Tracker.Current.Contact).GetAutomationStates()) { states.Add(String.Format("{0}: {1}", context.PlanItem.DisplayName, context.StateItem.DisplayName)); } } else { states.Add(SiteConfiguration.GetDictionaryText("No Engagement States")); } } catch (Exception) { states.Add(SiteConfiguration.GetDictionaryText("Unable to load Engagement States")); } return(states); }
public override void Apply([NotNull] T ruleContext) { var state = Context.Database.GetItem(new ID(StateId)); if (state != null && state.Template.Key == "engagement plan state") { var a = AutomationStateManager.Create(Tracker.Current.Contact); a.EnrollInEngagementPlan(state.ParentID, state.ID); } }
public override void Apply([NotNull] T ruleContext) { // Execute action Item state = Sitecore.Context.Database.GetItem(new ID(StateId)); if (state != null && state.Template.Key == "engagement plan state") { //This is how you add a contact out of context, but I am in context, so the below lines are proper way. //Sitecore.Analytics.Automation.AutomationContactManager.AddContact(Sitecore.Analytics.Tracker.Current.Contact.ContactId, state.ID); var a = AutomationStateManager.Create(Sitecore.Analytics.Tracker.Current.Contact); a.EnrollInEngagementPlan(state.ParentID, state.ID); } }
public IEnumerable <string> LoadEngagementStates() { var states = new List <string>(); try { var automationStateManager = AutomationStateManager.Create(Tracker.Current.Contact); var engagementstates = automationStateManager.GetAutomationStates().ToArray(); states.AddRange(engagementstates.Select(context => $"{context.PlanItem.DisplayName}: {context.StateItem.DisplayName}")); } catch (Exception ex) { Log.Error("VisitInformation: Could not load engagement states", ex); } return(states); }
public IEnumerable <EngagementPlanState> GetCurrent() { try { var automationStateManager = AutomationStateManager.Create(Tracker.Current.Contact); var engagementStates = automationStateManager.GetAutomationStates().ToArray(); return(engagementStates.Select(stateContext => new EngagementPlanState { EngagementPlanTitle = stateContext.PlanItem.DisplayName, Title = stateContext.StateItem.DisplayName, Date = stateContext.EntryDateTime }).ToArray()); } catch (Exception ex) { Log.Error("VisitInformation: Could not load engagement states", ex); return(Enumerable.Empty <EngagementPlanState>()); } }
private static void ProcessProfile(Sitecore.Data.Items.Item profileItem) { // update the traker var profile = Tracker.Current.Interaction.Profiles[Constants.Items.Profiles.Industry.Name]; var scores = new Dictionary <string, float> { { profileItem.Name, 10 } }; Log.Info("KickFire: Looking up profile " + profile.ProfileName, "KickFire"); profile.Score(scores); profile.UpdatePattern(); Log.Info("KickFire: Putting user is EngagementPlans plan.", "KickFire"); var a = AutomationStateManager.Create(Tracker.Current.Contact); a.EnrollInEngagementPlan(IDs.EngagementPlans.KickFire, IDs.EngagementPlans.State.BeginingState); Log.Info("KickFire: ====== ALL IS DONE ======", "KickFire"); }