I cant find any documentation about this, so how do I check this?
Litium version: 6.3.7
I cant find any documentation about this, so how do I check this?
Litium version: 6.3.7
You can check it like this:
var targetGroupId = "MyTargetGroupId"; // This Id is in your created TargetGroup table (if created from BO it will be as string-Guid)
var targetGroup = _targetGroupService.Get(targetGroupId);
if (targetGroup != null)
{
var conditionSystemId = targetGroup.Conditions?.FirstOrDefault().SystemId;
if (conditionSystemId != null)
{
var context = System.Web.HttpContext.Current;
var sessionTargetGroupList = (System.Collections.Generic.Dictionary<Guid,TargetGroupContextData>)context.Items["Litium.Web.Customers.TargetGroups.TargetGroupSessionContextImpl#TempData"];
var myTargetGroup = sessionTargetGroupList[targetGroup.SystemId];
if (myTargetGroup != null)
{
var existsInGroup = myTargetGroup.ProcessedConditions.Any(x => x.Equals(conditionSystemId));
}
}
}
There seems to be an easier way also
var targetGroupId = "MyTargetGroupId"; // This Id is in your created TargetGroup table (if created from BO it will be as string-Guid)
var targetGroup = _targetGroupService.Get(targetGroupId);
if (targetGroup != null)
{
var existsInGroup = _targetGroupEngine.IsApplied(targetGroup.SystemId);
}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.