Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gets the SampleOrders from a xDB by interacting with the Facet in API
private void PassContactElementIntoQueryResult(ReportProcessorArgs args)
DataTable queryResultTable = new DataTable();
queryResultTable.Columns.Add(new ViewField<string>("DecorId").ToColumn());
queryResultTable.Columns.Add(new ViewField<string>("RangeId").ToColumn());
var contactRepository = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository;
var contact = contactRepository.LoadContactReadOnly(args.ReportParameters.ContactId);
IKeyInteractionsFacet facet = contact.GetFacet<IKeyInteractionsFacet>(KeyInteractionsFacet.FacetName);
foreach (var sampleOrder in facet.SampleOrders)
DataRow dataRow = queryResultTable.NewRow();
dataRow["DecorId"] = sampleOrder.DecorId;
dataRow["RangeId"] = sampleOrder.RangeId;
args.QueryResult = queryResultTable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.