DateTimeDiff vs GetDayOfWeek in Architect Expression

Trying to route calls based on whether it’s a business day. DateTimeDiff gives me the delta in hours, but I need to know the day of the week. GetDayOfWeek exists, but the syntax is tricky. How do I combine these in a single expression to check if the current day is a weekday? Getting parse errors when nesting them.

Studio handles date logic differently than Architect, so the syntax you’re fighting is likely the string parsing. You don’t need to nest complex functions if you use the dayOfWeek property directly on the timestamp object.

  • Drop the DateTimeDiff entirely. It’s overkill for a simple weekday check.
  • Use GetCurrentTimestamp() to get the current moment.
  • Extract the day using the .dayOfWeek property. This returns an integer (0=Sunday, 6=Saturday).
  • Wrap it in a simple boolean check for routing conditions.

Here’s the exact expression that works in a Studio flow condition:

GetCurrentTimestamp().dayOfWeek >= 1 && GetCurrentTimestamp().dayOfWeek <= 5

If you need to handle specific holidays or complex business hours, don’t hardcode logic in the expression. It becomes a maintenance nightmare. Instead, push a isBusinessDay attribute from an external service via a REST Proxy call. Studio is great at consuming JSON booleans.

The parse errors you’re seeing usually come from trying to chain string conversions on the timestamp object. Keep it native. The .dayOfWeek property is reliable and doesn’t require locale formatting tricks.

If you’re dealing with timezone shifts (e.g., agents in different zones), apply the timezone offset first:

GetCurrentTimestamp().toTimezone("America/Chicago").dayOfWeek >= 1 && GetCurrentTimestamp().toTimezone("America/Chicago").dayOfWeek <= 5

This ensures the day of the week aligns with the agent’s local time, not the server’s UTC time. Miss that and you’ll route calls to closed queues on Sunday evenings in Chicago.