9

What is the accepted method of preventing a contact from registering an outcome multiple times? For example, if they become a "Marketing Lead", how do I prevent that Outcome from firing again for that contact?

Do you need to programmatically check to see if the outcome has already been registered for the contact? Or is there a configuration setting for this?

I see the "Ignore Additional Registrations" checkbox, but I am not sure what it does.

I am using Sitecore 8.1 Update 2 with xDB Cloud.

1 Answer 1

5

You are correct—the "Ignore Additional Registrations" checkbox will make sure that nothing happens in case an existing outcome is attempted to be registered again.

Here's an excerpt from the decompiled class Sitecore.Analytics.Outcome.OutcomeManager:

public virtual void Save(IOutcome outcome)
{
  if (!this.CanSaveOutcome(outcome))
  {
    return;
  }

  this.repository.Save(outcome);
}

private bool CanSaveOutcome(IOutcome outcome)
{
  IDefinitionManager<IOutcomeDefinition> definitionManager =
    DefinitionManagerFactory.Default.GetDefinitionManager<IOutcomeDefinition>(null);

  IOutcomeDefinition outcomeDefinition =
    definitionManager.Get(outcome.DefinitionId, CultureInfo.InvariantCulture);

  return
    outcomeDefinition == null
    || !outcomeDefinition.AdditionalRegistrationsAreIgnored
    || !this.HasOutcome(outcome.EntityId, outcome.DefinitionId);
}

As you can see, OutcomeManager.Save() will only register the outcome if the checkbox "Ignore Additional Registrations" is unchecked, or if the outcome has not been registered yet.

As a side note, it's quite interesting that the outcome will be saved successfully even if you specify a non-existing outcome definition ID in outcome.DefinitionId.

4
  • Interestingly, it won't let me check the box. When I check it, and click save it just flashes the screen and the box isn't checked. I can save a change to the Marketing Lead name, but not that checkbox. It seems I can't change that value for any of the built in Outcomes? Commented Oct 5, 2016 at 16:53
  • @eat-sleep-code That's interesting. Could you please create a separate question about this issue? Commented Oct 5, 2016 at 18:29
  • I have created a separate question on this complete with the error that seems to get written to the log. Thanks! Commented Oct 5, 2016 at 18:51
  • 1
    A tad bit late: but there is an existing bug in 8.1 update 2 that prevents the box from being checked. Sitecore released a hotfix for it: (reference number 128651)
    – Bas Lijten
    Commented May 14, 2017 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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