I’m trying to set up a routing rule in Architect that only triggers during specific business hours and days. We’ve got a custom attribute last_call_date on the user profile that gets updated via an API call.
The goal is to check if the last call was more than 3 days ago. If it was, we route to a specific queue. Otherwise, we skip it.
I tried using the DateTimeDiff function first. Here’s the expression I wrote in the Data Action:
DateTimeDiff('yyyy-MM-dd', GetAttribute('last_call_date'), GetCurrentDateTime()) > 3
The problem is that this expression evaluates to null instead of a boolean or a number. I’ve checked the format of last_call_date in the debug logs, and it looks correct (e.g., 2023-10-25). I assumed DateTimeDiff would return the difference in days as an integer so I could compare it to 3. But the documentation is a bit vague on whether the first parameter controls the unit of return.
So I tried switching to GetDayOfWeek to see if I could at least filter by day, just to test if the date parsing is working at all:
GetDayOfWeek(GetAttribute('last_call_date')) == 1
This one actually returns a value (I see 1 for Monday in the trace). It seems like GetDayOfWeek handles the date string conversion correctly, but DateTimeDiff chokes on it or returns null because of the format mismatch.
Is there a specific format required for the date string in DateTimeDiff? Or am I using the wrong function entirely for comparing two date values in Architect expressions? I’ve tried changing the format to dd/MM/yyyy but that just makes it return null immediately.
Here’s the JSON payload we’re sending to update the attribute if that helps:
{
"last_call_date": "2023-10-25T14:30:00Z"
}
I’m stuck on this part. The routing logic depends on this check.