I'm trying to implement personalization with the contact custom facet in xDB pulled using xConnect. Here I'm using ICondition as mentioned in the Sitecore doc link. After implementing everything, It's not hitting my Evaluate method and throwing the below exception in logs:

"ERROR Type AssemblyName.FolderName.ClassName not found in assembly Assembly Name"

Not sure if I am missing anything. Please suggest.

Adding the code snippet and rule for more information

Code Snippet

Rule under sitecore content tree

Sitecore Content Tree

Rendering Personalization

enter image description here

  • 1
    did you deploy your code? – Vlad Iobagiu Jan 11 '18 at 7:13
  • Yes, I have added the assembly dll to the sitecore publish folder – Sudheer Suggu Jan 11 '18 at 7:26
  • Which logs? Sitecore logs or the xConnect logs or the automation engine logs? – Jason St-Cyr Jan 11 '18 at 8:46
  • It is in sitecore logs – Sudheer Suggu Jan 11 '18 at 8:47
  • 1
    Yes, it is a conditional rendering and published every thing and attached the screen shot of my personalization – Sudheer Suggu Jan 11 '18 at 10:27

I'm not quite sure why SC throws that exception but what you and I were trying to accomplished is not following that documentation. you need to implement a class similar to NowCondition, I think SC looks for classes that inherits for RuleContext. Here is an working example, ps. the text needs to be [PropertyName, Control, Parameter, Display Value] for instance [MyProperty,,,City Name]

public class NowCondition<T> : WhenCondition<T> where T : RuleContext
/// <summary>Gets or sets the UTC date.</summary>
/// <value>The UTC date.</value>
public string Now { get; set; }

/// <summary>Executes the specified rule context.</summary>
/// <param name="ruleContext">The rule context.</param>
/// <returns><c>True</c>, if the condition succeeds, otherwise <c>false</c>.</returns>
protected override bool Execute(T ruleContext)
  DateTime utcNow = DateTimeProvider.GetUtcNow();
  DateTime dateTime = DateUtil.ParseDateTime(this.Now, DateTime.MaxValue);
  if (dateTime.Kind != DateTimeKind.Utc)
  return utcNow > dateTime;

/// <summary>Handles the invalid DateTime Kind.</summary>
protected virtual void HandleInvalidDateKind()
  Log.Warn("Sitecore.Rules.Conditions.DateTimeConditions.NowCondition<T> expects UTC date, but date with different kind has been assigned to Now property: " + this.Now, (object) this);
  • This is a bad example. Specially if the core of the problem is the contact facet, and you dont even touch that subject. – GonacFaria Jul 3 '19 at 14:18

I think you are getting personalisation rules and contact facets confused. The IContactService is used to extend the model(information) that is stored against a user.

If you are implementing IContactService you would be for example adding a "site theme" to every contact. For this you need to add a "schema name" into the config as well as deploy your new facet model as json to xconnect.

As Albernazf pointed out if you are trying to implement a custom personalisation rule you will need to use the Syntax "NowCondition : WhenCondition where T : RuleContext" and have public property which matches the rule you set in sitecore.

Let me know if you need further details on either concept.

  • 1
    Thanks for the response, I would like to read the contact information stored in xDb through xconnect, based on the data I would like to perform personalization. Could you please provide more info on this.. – Sudheer Suggu Mar 22 '18 at 10:30
  • I have done this recently. My approach was to call a service which checks the contact information from my custom rule. Your code that uses the XConnect API should be called from within the "Execute" method of your custom rule(see Albernazf answer) . – JKerny Mar 22 '18 at 23:17

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.