0

I am trying to implement a class that uses the Sitecore.Analytics.OmniChannel.Pipelines.DetermineInteractionChannel.DetermineChannelProcessorBase class. My question was to know if there was a way to pass the queried item field's value in a way similar to how it is possible to extend the Layout Service in Sitecore JSS by passing values through the context and make them available to a React component. Something similar to Extending Sitecore JSS Layout if possible.

The method where I want to implement the logic is the following

public override void Process(DetermineChannelProcessorArgs args){
 string sitecoreQuery = "myQuery"
Item myItem = Context.Database.SelectSingleItem("myQuery");
string fieldValue = myItem.fields["myField]?.Value;
//make fieldValue available to get from React component
}
0

This was resolved using Sitecore.Context.HttpContext and then creating a separate extension like the one shown in the link above.

Analytics handler class

public override void Process(DetermineChannelProcessorArgs args){
   string sitecoreQuery = "myQuery";
   Item myItem = Context.Database.SelectSingleItem("myQuery");
   string fieldValue = myItem.Fields["myField"]?.Value;
   Sitecore.Context.HttpContext.Session.Add("myField", fieldValue);
}

Layout extension class

protected override void DoProcess(GetLayoutServiceContext args, AppConfiguration application){
var fieldValue = Sitecore.Context.HttpContext.Session["myField"];
args.ContextData.Add("fieldName", fieldValue);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.