Skip to content

Instantly share code, notes, and snippets.


Ben Golden BenGGolden

View GitHub Profile
View SetPasswordSaveAction.cs
public class SetPasswordSaveAction : UserBaseAction
private ID _formId;
public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null,
params object[] data)
_formId = formId;
var password = adaptedFields.GetEntry(PasswordField, "Password")?.Value ?? string.Empty;
var userName = Tracker.Current?.Session.Contact.Identifiers.Identifier;
var user = Membership.GetUser(userName);
BenGGolden / IsInEngagementStateCondition.cs
Created Nov 29, 2016
Sitecore rule engine condition to determine if the current user is in a particular engagement plan state
View IsInEngagementStateCondition.cs
public class IsInEngagementStateCondition<T> : WhenCondition<T> where T : RuleContext
public ID StateId { get; set; }
protected override bool Execute(T ruleContext)
var automationStateManager = Tracker.Current.Session.CreateAutomationStateManager();
return automationStateManager.IsInEngagementState(StateId);
BenGGolden / RegisterGoalAction.cs
Created Nov 27, 2016
Sitecore rule engine action to register a goal
View RegisterGoalAction.cs
public class RegisterGoalAction<T> : RuleAction<T> where T : RuleContext
public ID GoalId { get; set; }
public override void Apply(T ruleContext)
if (!Tracker.IsActive || Tracker.Current.CurrentPage == null) return;
var goal = (PageEventItem)Context.Database.GetItem(GoalId);
if (goal != null)