Date taking the value relative to previous entered date value even after clearing the entity

Hi Team,
I am using a date entity. There is also an option for the user to change the date if they have entered it incorrectly. During this step the date entity is cleared and the new date is asked from the user (date entity).

The problem that I am experiencing:

Today’s date: 2020-11-30

If the user gives the input as next Tuesday then it takes the correct value of 2020-12-08.

Now when the user tries to enter new date (after clearing the entity) as next Wednesday ,
it gives date as 2020-12-16 whereas the date should be 2020-12-09.

The previous value of the date (2020-12-08) is taken as a reference in calculating the new date though I am clearing the entity values.

I request you to look into this issue and please let me know how to solve this.

Please find below the screenshots.

Thanks.

Hi @viswanathan, I will check this internally and get back to you as soon as possible.

cc @yogaramya.mendu

This relative date calculation is the default mechanism and that is tracked in some internal state that a bot developer cannot access.

However you can influence the reference date through entity rules. See https://developer.kore.ai/docs/bots/how-tos/entity-rules/ and the referenceDate rule for a date entity.

Hi Team,

Good Afternoon.

Can you give an example on how to use this to the dialog task. I added the script node before the entity node and I gave the value referring to the documentation. But I got error saying "Cannot set property ‘GetAppt’ of undefined"

Below attached is the screenshot of the script node that was added.

image

I request you to look into this and give a solution for the same.

Thanks.

The entityRules property doesn’t ordinarily exist in context. So need to expand the JSON.

context.entityRules = {
    GetAppt : {
        "referenceDate" : "today"
    }
}

“today” is a special keyword that is resolved to the current date.

1 Like