jan-h
9/23/2014 - 1:35 PM

Query SDL SmartTarget 2014 trough the new QueryBuilder API

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"));