Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 2705 characters in body
Source Link

I have seen all of the custom rules execute correctly. This is the only rule that I have not seen execute correctly. Possibly if there is one rule that is incorrect it would stop personalization running altogether?

public class AptifyMemberDuesPaidThruCondition<T> : OperatorCondition<T> where T : RuleContext
{
    private readonly IAptifyAuthenticator _aptifyAuthenticator;

    public AptifyMemberDuesPaidThruCondition() : this(ServiceLocator.ServiceProvider.GetService<IAptifyAuthenticator>())
    { }

    public AptifyMemberDuesPaidThruCondition(IAptifyAuthenticator aptifyAuthenticator)
    {
        _aptifyAuthenticator = aptifyAuthenticator;
    }

    public string DuesPaidThru { get; set; }

    /// <summary>
    /// This function will be called to test the condition
    /// </summary>       
    protected override bool Execute(T ruleContext)
    {

        //Check if the user is logged in, otherwise return false
        if (!_aptifyAuthenticator.UserAptifyAuthenticated())
            return false;

        DateTime dateTime = DateUtil.ParseDateTime(this.DuesPaidThru, DateTime.MinValue);
        if (dateTime.Kind != DateTimeKind.Utc)
        {
            string str = string.Concat("AptifyMemberDuesPaidThruCondition<T> expects UTC date, but date with different kind has been assigned to Now property: ", this.DuesPaidThru);
            Log.Warn(str, this);
        }

        var actualDuesPaidThru = _aptifyAuthenticator.GetUserCustomerPropertyDate(AuthenticatedPropertyName.DuesPaidThru);

        if (!actualDuesPaidThru.HasValue)
            return false;

        return DateComparer(actualDuesPaidThru.Value, dateTime, GetOperator());

    }

    private bool DateComparer(DateTime date1, DateTime date2, ConditionOperator conditionOperator)
    {

        switch (conditionOperator)
        {
            case ConditionOperator.Equal:
                return date1.Equals(date2);
            case ConditionOperator.LessThan:
                return date1 < date2;
            case ConditionOperator.LessThanOrEqual:
                return date1 <= date2;
            case ConditionOperator.GreaterThan:
                return date1 > date2;
            case ConditionOperator.GreaterThanOrEqual:
                return date1 >= date2;
            case ConditionOperator.NotEqual:
                return !date1.Equals(date2);
            default:
                return false;
        }

    }
}

Any ideas where to troubleshoot?

Any ideas where to troubleshoot?

I have seen all of the custom rules execute correctly. This is the only rule that I have not seen execute correctly. Possibly if there is one rule that is incorrect it would stop personalization running altogether?

public class AptifyMemberDuesPaidThruCondition<T> : OperatorCondition<T> where T : RuleContext
{
    private readonly IAptifyAuthenticator _aptifyAuthenticator;

    public AptifyMemberDuesPaidThruCondition() : this(ServiceLocator.ServiceProvider.GetService<IAptifyAuthenticator>())
    { }

    public AptifyMemberDuesPaidThruCondition(IAptifyAuthenticator aptifyAuthenticator)
    {
        _aptifyAuthenticator = aptifyAuthenticator;
    }

    public string DuesPaidThru { get; set; }

    /// <summary>
    /// This function will be called to test the condition
    /// </summary>       
    protected override bool Execute(T ruleContext)
    {

        //Check if the user is logged in, otherwise return false
        if (!_aptifyAuthenticator.UserAptifyAuthenticated())
            return false;

        DateTime dateTime = DateUtil.ParseDateTime(this.DuesPaidThru, DateTime.MinValue);
        if (dateTime.Kind != DateTimeKind.Utc)
        {
            string str = string.Concat("AptifyMemberDuesPaidThruCondition<T> expects UTC date, but date with different kind has been assigned to Now property: ", this.DuesPaidThru);
            Log.Warn(str, this);
        }

        var actualDuesPaidThru = _aptifyAuthenticator.GetUserCustomerPropertyDate(AuthenticatedPropertyName.DuesPaidThru);

        if (!actualDuesPaidThru.HasValue)
            return false;

        return DateComparer(actualDuesPaidThru.Value, dateTime, GetOperator());

    }

    private bool DateComparer(DateTime date1, DateTime date2, ConditionOperator conditionOperator)
    {

        switch (conditionOperator)
        {
            case ConditionOperator.Equal:
                return date1.Equals(date2);
            case ConditionOperator.LessThan:
                return date1 < date2;
            case ConditionOperator.LessThanOrEqual:
                return date1 <= date2;
            case ConditionOperator.GreaterThan:
                return date1 > date2;
            case ConditionOperator.GreaterThanOrEqual:
                return date1 >= date2;
            case ConditionOperator.NotEqual:
                return !date1.Equals(date2);
            default:
                return false;
        }

    }
}

Any ideas where to troubleshoot?

formatting
Source Link
Gatogordo
  • 20.3k
  • 2
  • 39
  • 100

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as when [date] has passed to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.Enabled and Xdb.Tracking.Enabled set to true.

I am testing in normal mode. I have Sitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as when [date] has passed to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.Enabled and Xdb.Tracking.Enabled set to true.

I am testing in normal mode. I have Sitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as when [date] has passed to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.Enabled and Xdb.Tracking.Enabled set to true.

I am testing in normal mode. I have Sitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as "when [date] has passed"when [date] has passed to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.EnabledXdb.Enabled and Xdb.Tracking.EnabledXdb.Tracking.Enabled set to truetrue.

I am testing in normal mode. I have Sitecore.xDB.baseSitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as "when [date] has passed" to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.Enabled and Xdb.Tracking.Enabled set to true.

I am testing in normal mode. I have Sitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.

Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.

I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as when [date] has passed to no avail. It is just not stepping through the conditions.

This is on Sitecore.NET 8.2 (rev. 160729)

I have values Xdb.Enabled and Xdb.Tracking.Enabled set to true.

I am testing in normal mode. I have Sitecore.xDB.base license.

I see nothing in logs.

Below are the control properties and personalization rules. If the control does not have a data source nothing shows.

Control Properties

Personalization Rules

Any ideas where to troubleshoot?

added 109 characters in body
Source Link
Loading
added 49 characters in body; edited title
Source Link
Loading
added 177 characters in body; edited title
Source Link
Loading
added 282 characters in body
Source Link
Loading
added 66 characters in body
Source Link
Loading
Source Link
Loading