Skip to content

Instantly share code, notes, and snippets.

@gillissm
Last active February 10, 2016 21:19
Show Gist options
  • Save gillissm/0bb132a8dd35416f643c to your computer and use it in GitHub Desktop.
Save gillissm/0bb132a8dd35416f643c to your computer and use it in GitHub Desktop.
Override Execute method for a custom Sitecore Conditional Rule
protected override bool Execute(T ruleContext)
{
Assert.ArgumentNotNull((object)ruleContext, "ruleContext");
Assert.IsNotNull((object)Tracker.Current, "Tracker.Current must be not null");
Assert.IsNotNull((object)Tracker.Current.Contact, "Tracker.Current.Contact must be not null");
if (string.IsNullOrWhiteSpace(ContactFacetMemberPath) || Tracker.Current.Contact == null)
return false;
//Custom method that reads the facet member XML path and using reflection retrieves the value.
var memberValue = GetFacet(ContactFacetMemberPath, Tracker.Current.Contact);
return !string.IsNullOrWhiteSpace(memberValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment