Hey folks,
Running into a weird issue with date comparisons in Architect. I’m trying to trigger a specific routing step if the current time is within 24 hours of a custom attribute last_contact_date.
I’ve set up the expression like this:
DateTimeDiff(SystemDateTime, GetCustomAttributeValue("last_contact_date"), "hours") < 24
The problem is it seems to flip the sign randomly. Sometimes it returns a positive number, sometimes negative, even when last_contact_date is clearly in the past. I’ve double-checked the timezone settings in Genesys Cloud and they match our US/Pacific office.
Is DateTimeDiff sensitive to the order of the arguments? The docs aren’t super clear on which date needs to be first. I tried swapping them:
DateTimeDiff(GetCustomAttributeValue("last_contact_date"), SystemDateTime, "hours") < 24
That just made it worse. Now I’m getting errors about invalid date formats in the logs. Any idea what’s going on?
Also, should I be using GetDayOfWeek for this? I saw someone mention it for weekend routing, but that doesn’t seem right for a 24-hour window.
Here’s the JSON payload from the webhook if it helps:
{
"last_contact_date": "2023-10-27T14:30:00Z",
"status": "pending"
}