Skip to content

Instantly share code, notes, and snippets.

@jhorsman
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhorsman/a99d094039aee4de8c3d to your computer and use it in GitHub Desktop.
Save jhorsman/a99d094039aee4de8c3d to your computer and use it in GitHub Desktop.
Query SDL SmartTarget 2014 trough the new QueryBuilder API
// get the triggers from ADF
ClaimStore claimStore = AmbientDataContext.CurrentClaimStore;
string triggers = AmbientDataHelper.GetTriggers(claimStore);
// make query builder and feed the triggers into it
var queryBuilder = new QueryBuilder();
queryBuilder.Parse(triggers);
// set the publication id and SmartTarget region. Both are required to query
// for SmartTarget promotions
queryBuilder.AddCriteria(new PublicationCriteria(new TcmUri("tcm:0-69-1")));
queryBuilder.AddCriteria(new RegionCriteria("Homepage Promotions"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment