Only When on backend workflows

I cannot seem to get the only when on my backend work flow to work right. this is a scheduled api call that changes the info field section of a notification data type (text) to show how much time is left before a specific job is supposed to begin. This way employees using the system can receive reminders of an upcoming job, and the time before that job is supposed to begin will update every time the page refreshes. However, here is my issue, the only when is set up to answer a yes/no about whether or not the current date/time is less than the scheduled next appointment of a job, but since the system shows multiple notifications to a user (because users are going to have multiple jobs assigned to them, I need the backend workflow to update each job’s notification’s info. And because that makes it a list, I cannot say that a date is less than a list of dates. Does anyone have any suggestions as to what I can do here? Or is there a way to tell the backend workflow to measure if the current date/time is less than the date and time of each date/time for scheduled upcoming jobs?

Screenshot below:

Screenshot 2024-02-27 11.26.52 PM

One way would be to extract the earliest and latest dates of the list of dates. Every time one gets added to update each of these ends if appropriate. And have your only when condition against these ends

1 Like

If it is not a range then just capture the end that suits you (oldest or earliest out of the list of dates)

I will try this! Thank you!

1 Like

@hullaustinj extracting the earliest and latest dates on the list in my view is not what you want to do, because that will just be the earliest date of ALL Jobs and the latest date of ALL jobs, not a specific job, so your system would not function as you require.

You are using a workflow to make changes to a LIST, which is working on a LIST of Jobs, which does happen One at a Time, and so normally when working with the actions on a list action, you have as part of a dynamic expression a value that would be something like ‘this job’ to specify the job from the list that is currently being processed. I personally do not know if that would be available in the conditions as the condition is on the actual action itself, which is really about whether to run the action at all, and not about a single job within the list.

From the description of the feature you presented it sounds to me like you want to have a notification available to your user about a specific job, which may be more than one, but each one treated separately as they would have their own associated dates. You want these notifications to be presented to the user when they are logged into the app, not necessarily at login, but whenever they are in the app and the time until the job is supposed to start so they have a sort of count down timer of when they need to begin their next job.

I don’t know 100% exactly what you are trying to achieve as personally, I would not be making this a notification since my interpretation of your goal is to simply show that they user has for example 4 days until a job is to begin. If all you want to do is show the user the list of jobs they are assigned and the number of days/hours until the job is due to begin, all you need is a repeating group with data type of jobs. Your data type of jobs would need a single field for start date. In the repeating group have a text element with a dynamic expression of ‘current cell's jobs start date - current date time: formatted as days

The above setup in a repeating group will allow the user to see the number of days from the current date/time until the job is due to start. Of course in the RG, you will also need a text element to display to the user which job, so that is up to you to decide what you have in the DB that will allow the user to know which job it is (maybe a title or something?). Additionally, you can make it so the text element showing the number of days until due to show the number of hours until due to start if you want using conditionals that determine if the current date time is the same day as the start date and change the text to use the same expression I presented above but change format as days to format as hours…this is only if you are saving into the DB the start date with a time component and not just simply a date.

This way, you do not unnecessarily use WUs to run processing that can be done client side nearly instantaneously, nor do you need to try and figure out the workflows to make that processing possible.


Thank you! Looking at it this way i can definitely see i was over complicating it. But thats why i appreciate the forum.