0

I'm trying to show a component dependent on a Sitecore outcome. I've confirmed that this outcome is being triggered and given to the contact.

Sitecore outcome history

Now I have a rule set up to either show or hide a component dependent on this outcome. Sitecore rule engine

The rule never passes. If I change the rule to something like a specific page being viewed it works fine. Changing it back to the outcome rule causes it to always fail.

Am I doing something wrong? I have the full Experience Platform.

EDIT: I'm using Sitecore 8.0

Code for registration:

if (Tracker.Current == null)
            return false;

        ID group = GroupOutcomes[groupId]; //array of item ids for the outcomes
        if (Tracker.Current.HasOutcome(group))
            return false;

        ID id = ID.NewID;
        ID interactionId = ID.Parse(Tracker.Current.Interaction.InteractionId);
        ID contactId = ID.Parse(Tracker.Current.Contact.ContactId);

        var finalGroup = new ContactOutcome(id, group, contactId)
        {
            DateTime = DateTime.UtcNow.Date,
            MonetaryValue = 0,
            InteractionId = interactionId
        };

        Tracker.Current.RegisterContactOutcome(finalGroup);

I see the outcome being given to the contacts and I actually display a contacts outcomes on the page load to see if the definition Ids match and they do.

KevinDev
  • 73
  • 8
  • Could you share the code for triggering the outcome? Also, can you confirm the outcome is recorded on the contact’s activity tab? – Pedro Fonseca Mar 03 '17 at 16:41
  • @PedroFonseca I've updated the question to include outcome registration code – KevinDev Mar 03 '17 at 16:49
  • @PedroFonseca Also, it seems to be losing Tracker outcomes when my sessions expire. I left my window open for about 30 minutes and refreshing the page cleared all my past outcomes – KevinDev Mar 03 '17 at 16:51
  • Have you tried this code for registering the outcome? - this worked for me https://gist.github.com/ianjohngraham/71c21ec6b9055e07c5dd. If this still doesn't work try reflecting the Rule to see what code is used to check for an outcome – Ian Graham Mar 06 '17 at 07:26

1 Answers1

1

Answering this in case someone has a similar problem.

This was a bug in Sitecore 8.0. Here is what I did with help from Sitecore to fix the problem

Solution:

1) Navigate to the "/sitecore/system/Settings/Rules/Definitions/Elements/Outcomes/Contact Has Registered Outcome During Any Interaction" item and change its Text field as follows: where the current contact has registered the [OutcomeDefinition,Tree,root=/sitecore/system/Marketing Control Panel/Outcomes,outcome] during any interaction

2) Save and publish the item.

3) Navigate to the "/sitecore/system/Settings/Rules/Definitions/Elements/Outcomes/Contact Has Registered Outcome During Any Interaction with Value" item and change its Text field as follows: where the current contact has registered the [OutcomeDefinition,Tree,root=/sitecore/system/Marketing Control Panel/Outcomes,outcome] during any interaction where monetary value [operatorid,Operator,,compares to] [value,Decimal,,value]

4) Save and publish the item.

KevinDev
  • 73
  • 8