No worries at all.
If you are doing this inside a task in an Inbound Call Flow, you can create it as a Task variable instead.
UTC time → add 570 minutes → local date/time → extract hour → pass hour into script.
Original Message:
Sent: 05-11-2026 01:46
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
firstly thanks you so much for you continued help.
So in my incoming call flow there is no such flow localdatetiem, it says i shoudl be able to creat e but once again this is not clear hoiw to add a flow variable
------------------------------
Simon Oldroyd
Original Message:
Sent: 05-11-2026 01:23
From: Phaneendra Avatapalli
Subject: Disabling a button in script outside of certain hours
CurrentHour is just the script variable name I used in my test, not the data action name.
Your data action can still be called currentdate.
If /api/v2/date is returning UTC time, I don't think I'd try to make the script handle the offset directly. I'd convert the time before passing the value into the script.
For GMT+9:30, you need to add 570 minutes to the UTC time:
9 hours × 60 = 540
+ 30 minutes = 570
For example, in Architect logic before the screen pop, you could do something like:
Flow.LocalDateTime = AddMinutes(GetCurrentDateTimeUtc(), 570)
That would return the full converted local date/time.
Then you can extract just the local hour using:
Flow.CurrentHour = Hour(Flow.LocalDateTime)
Then pass Flow.CurrentHour into the script input variable:
CurrentHour
The script button Visible expression can then stay as:
({{CurrentHour}} >= 9 and {{CurrentHour}} < 17)
So the script receives the converted local hour in 24-hour format, rather than UTC/server time.
Hope this helps.
------------------------------
Phaneendra
Technical Solutions Consultant
Original Message:
Sent: 05-11-2026 01:08
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
so Currenthour that you use is the name of the data action? the data action i have created is named currentdate /api/v2/date and that works when i run the test on it, but how do i put the offset in the dataaction which i will need to create a new one of course
------------------------------
Simon Oldroyd
Original Message:
Sent: 05-11-2026 00:55
From: Phaneendra Avatapalli
Subject: Disabling a button in script outside of certain hours
Great, sounds like the button visibility part is working now.
For the timezone issue, I think the easiest approach is to keep the script simple and do the timezone conversion before the value reaches the script.
In my quick test, I used a number variable called CurrentHour and this button Visible expression:
({{CurrentHour}} >= 9 and {{CurrentHour}} < 17)
That worked as expected:
10 → button visible
17 → button hidden
So for your setup, I'd suggest having the data action return the local hour for GMT+9:30 as a number in 24-hour format, rather than UTC/server time.
For example:
UTC 03:00 → local 12:30 → pass CurrentHour = 12
Then the same Visible expression should work, and the script does not need to parse raw time or handle timezone conversion.
The key is that CurrentHour should be the converted local hour in 24-hour format, for example:
9 = 9am
12 = midday
17 = 5pm
------------------------------
Phaneendra
Technical Solutions Consultant
Original Message:
Sent: 05-11-2026 00:24
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
So i have the button hidden good start thanks for that but i need it to be in GMT+930 time cause currently it appears to be UTC server time which is 3am
------------------------------
Simon Oldroyd
Original Message:
Sent: 05-10-2026 23:15
From: Phaneendra Avatapalli
Subject: Disabling a button in script outside of certain hours
Hi Simon,
I did a quick test on this and managed to get the button visibility working using a number variable.
In the script, I created a number variable called CurrentHour, then used the button's Visible property with a True/False expression.
The expression I tested was:
({{CurrentHour}} >= 9 and {{CurrentHour}} < 17)
I then passed different values into CurrentHour (as Number) from the screen pop/script input:
10 → button was visible
17 → button was hidden
So if your data action can return just the current hour as a number, for example 17, then you should be able to map that value into the script input variable and use it in the Visible expression.
That avoids trying to parse raw time in the script, which may be what was causing the NaN issue.
Hope this helps.
------------------------------
Phaneendra
Technical Solutions Consultant
Original Message:
Sent: 05-10-2026 22:22
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
raw curret time currently, in the script last week i added the variable with the time for in and out of hours but teh variable to get current time didnt work returnign Nan, so i have removed it all to start again
------------------------------
Simon Oldroyd
Original Message:
Sent: 05-10-2026 22:11
From: Phaneendra Avatapalli
Subject: Disabling a button in script outside of certain hours
Hi Simon, No worries what are you currently getting back from the time check data action?
For example:
Also, are you able to successfully map the data action output into a script variable, or is that the part that is failing?
I think understanding what the action response/output looks like will help narrow down whether the issue is with:
the data action response,
the script variable mapping,
or the button Visible expression itself.
------------------------------
Phaneendra
Technical Solutions Consultant
Original Message:
Sent: 05-10-2026 22:04
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
Thanks for the response but i think it is the script variable that i am actually struggling with
------------------------------
Simon Oldroyd
Original Message:
Sent: 05-10-2026 21:24
From: Phaneendra Avatapalli
Subject: Disabling a button in script outside of certain hours
Hi Simon,
In the button's Visible property, you should be able to use a true/false expression based on a script variable.
For example, if your data action returns a boolean like isAfterHours, map that to a script variable such as Script.IsAfterHours.
Then in the button Visible expression, you could use something like:
!Script.IsAfterHours
That way:
During 5pm–9am, IsAfterHours = true, so the button is hidden
During 9am–5pm, IsAfterHours = false, so the button is visible
My understanding is the data action would need to run when the interaction/script loads, because the script won't continuously re-check the time unless something triggers the action again.
For new interactions after 5pm this should work fine, as the script will load and evaluate the current time then. The only edge case would be an interaction already open before 5pm, unless the check is triggered again.
Hope this helps.
------------------------------
Phaneendra
Technical Solutions Consultant
Original Message:
Sent: 05-10-2026 20:58
From: Simon Oldroyd
Subject: Disabling a button in script outside of certain hours
I would like to be able to diable a button in scripting oyt side of teh hours 5pm to 9am, i have a data action setup to get the current time that works well, but the variable and actions dont appear to work how i have been reading, any help would be great
------------------------------
Simon Oldroyd
------------------------------