Search constraint deffective

Hi, I am confused as to why my constraint is giving me different results than specified.

Here I have a constrain to search current date and where I change the time to match that which is in the database. Database date would be (03/11/2024 12:00 am)

However I receive the following results for two of the same workflows just a different second constraint:

  1. Constrain Monthly:


    The constraint is suppose to only change the time to 12:00 am (as it does within a text element when tested)

  2. Constrain Weekly:
    Screenshot 2024-03-11 at 09.52.20
    The upcoming-date parameter is not even a date (exact same constraint being used)

The result is that the workflow misses records and thus not working properly.
Thanks for any guidance.

I don’t think this has got anything to do with your problem… but why are you using such a complicated way to change the time to midnight?

You can just use current date/time rounded down to day

In any case, I’d guess this is a time zone issue…

Is this in a backend workflow? Or on the page? In any case, check the time zone settings for the workflow/page.

2 Likes

Thanks for the bit of advice. I implemented it immediately.

I do not see how it can be a timezone issue with my given scenario. It is a daily recurring event that has to search a database if there is a record with today’s date. All settings is set to current users timezone, where only one user has access to this workflow.

What time zone are you in, and/or what time zone is the User who has access to this workflow in?

Same timezone of GMT+2.

Well that certainly suggests it’s a time zone issue, as your date/time constraint is exactly 2 hours out from what you’re expecting it to be.

What time zone is your Recurring event set to run on?

Daily at 6am with current user’s timezone

What do you mean by Current User’s Timezone?

Is that a dynamic value you’re storing in the Database?

The initial recurring event had to be triggered by a user. So I assume it is based on his timezone.

I have never changed any timezone settings because this app is only used locally. So even if all the users used this workflow it would still be the same timezone.

So I guess the question is once the recurring event runs at 6am, which timezone does it use? The original users timezone or the system timezone that has a 8 hour difference?

If you haven’t defined the time zone for the Recurring event, then I’m pretty sure it will run in UTC (which would explain the 2 hour discrepancy in your constraint).

So I’d start by changing the time zone settings for the Recurring event to see if that fixes things.

How do I specify the Recurring Event time zone?

I’m so confused on how this actually works.

I played around with it most of the day and it really seems broken. When in development mode, the server logs state the search constraint is yesterday 10pm and the step by step debugger state today 12am. However the debugger shows no results with the search constraint where the server logs show results found and made the changes as per the workflow. BUT that only happens on development mode, Live mode no results are found and no changes are made.

On the recuring event itself:

image

note: you have to enable the Time Zone override feature in your app on the General Tab of your App Settings:

Have you got the relevant data in your Live database?

Yes I do

Well if no results are found then either there is no data to find (that matches the search constraints) or privacy rules are preventing it from being found. It can only be one of those two things.

I hear you and I understand that but look at the following as I explained earlier:

Database showing the 2 records before any action is taken (notice the upcoming-dates):

I then run the workflow (I created an additional workflow to run the same backend workflow immediately)

Server Log showing yesterday 10pm and shows made 1 change (2 hours before the database record)

Debugger showing search constraint with the correct date corresponding to that what is in the database but no results is shown:

The database showing the changes are performed even though no search criteria was found in the debugger and the server logs criteria was not matching:

Then when we go live with the same workflows, nothing is found and no changes are made:

Well, as I said, if nothing is found there’s either nothing to find, or what there is to find is restricted by privacy rules.

Have you checked both of those?

Like I showed here there is a value in the database that should match:

And both the development user and live user has all privacy settings enabled:

Well something’s obviously not right…

Feel free to share a link to your editor if you want me to take a quick look.