Last active
February 10, 2016 21:19
-
-
Save gillissm/0bb132a8dd35416f643c to your computer and use it in GitHub Desktop.
Override Execute method for a custom Sitecore Conditional Rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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