Wait condition in BOT

I am facing a situation in one of my BOTs in which i have added a delay using WAIT FOR A CONDITION as the starting step once the BOT is Triggered. Basically my intention was to delay the step until a particular time of day even though the BOT is Triggered. But even when the wait condition is met, the BOT does not continue with the remaining steps. I see status as pending in BOT Monitor. Below is the condition i gave for WAIT

Time(UTCNOW())>Time(โ€œ12:00:00โ€)

I have 2 questions basically

  1. How frequently does Appsheet check whether the condition is satisfied or not once the WAIT starts until condition is met. Like every minute or second.

  2. How long can a step be delayed before it ends up in error.

0 21 1,778
21 REPLIES 21

In the attached article, the wait limit is described as a minimum of 10 minutes and a maximum of 30 days. I would deduce from this that AppSheet checks the condition every 10 minutes.

Thanks for the reply @WillowMobileSystems . But in my case even when the wait condition is satisfied i.e utc time is > 12:00. Even after 10 or 15 mints or hours the step is not getting executed. It waiting indefinitely. Donโ€™t know where is the issue.

Are you expecting the Bot to trigger only once a day? If so, then a Scheduled Daily Bot would be more appropriate.

That doesnโ€™t negate the fact that the issue with Wait should still be looked into by AppSheet support.

the โ€œconditionโ€ in the wait step is meant to be applied on the triggering data change (for example, the column values in a data row that is just added or updated), it does not work for time-related expression.

And WillowMobileSystems is correct if you are expecting the bot to trigger daily, you should use create a scheduled event/bot.

Thanks!

I propose Automation should detect an attempt to do just this and prevent the config from saving. It should not be on the app creator to magically know this approach is not supported.

I was trying to build a bot that will be able to โ€˜schedule sendโ€™ SMS messages by making the bot wait for condition [Timestamp]<NOW(). I didnโ€™t realize that time functions wonโ€™t work here.

Now, Iโ€™m wondering: What if I made a new virtual column with the expression [Timestamp]<NOW() in it, and then set the bot to wait until that column was TRUE. Would that work to trigger the bot at the time I want the message to be sent?

Thatโ€™s a great alternative thought . I guess i should work.

Edit. I think there will still be a problem. Donโ€™t know whether the virtual column value will update automatically during the wait period since that is also a time expression.

It will not.

You can create a Duration Column with column Type as Duration and initial value [yourfutureTimstamp]-now().

Use this [duration] column like below in your task.

Hope it works for your requirement.

Thank you so much! That is a genius idea. I will try it out.

Just to update you:

It worked! I scheduled an SMS message on Monday night, to be sent on Thursday morning, and it successfully calculated the [duration] of 57 hours and then sent the SMS this morning. 

Thank you so much!

 

Thanks @Steve @WillowMobileSystems @Zhifeng_Lin

Finally found where i was going wrong. I didnโ€™t think that time expressions wonโ€™t work here. My intention here was not to schedule the bot daily. But once the bot is triggered by a particular data change the step should execute only at a particular time of day. I donโ€™t want the bot to run daily. Is there any other way to attain this.

There is no way to schedule a bot to run at an arbitrary time.

I found an alternate solution though its not a perfect one. But thought of sharing it here @Steve @Zhifeng_Lin @WillowMobileSystems

Instead of waiting for a condition in which i mentioned the time expression, now i used wait for a period. But in the duration field i gave the following expression

Time(โ€œ12:00:00โ€)-Time(UTCNOW())

This in turn will wait till the time reaches 12:00:00 by waiting for the mentioned duration. My BOT is always triggered before 12:00:00. Just a workaround i think. Pls comment on this.

I think a better approach, still, is to trigger a Scheduled Bot. It identifies ALL the rows that need the automation run on them and applies the updates to them all. This is much more efficient than having multiple iterations of the Bot waiting for a particular time to run.

So, for example, when the data updates are made, a flag named something like โ€œUpdate XYZ?โ€ is set to TRUE. The Bot runs at its designated time and looks for any rows where โ€œUpdate XYZ?โ€ are TRUE and runs the Bot Process against each of those rows.

If you want multiple runs throughout the day, then create several Scheduled Botsโ€ฆone for each trigger Time - e.g one runs at 1PM, a second at 3PM and a third at 5PM.

Thank you @WillowMobileSystems . It is perfect for scheduled BOTs. However, my requirement here is slightly different though. I donโ€™t want to run the BOT daily or weekly on a regular schedule. What my exact requirement is that I want the BOT to be triggered only on those days when a particular table is updated and one more condition is that once that table is updated, i want the step to get executed only at a particular time of that day. Hope I am clear with my requirement now. Sorry if i made any confusion earlier.

This is what I have understood and itโ€™s precisely how Scheduled Bots work. They run only at a particular time you have established and they can be configured to run ONLY when there are updates to process.

I completely understand what you are attempting to build. But you can accomplish it with a Scheduled Bot much easier and more efficiently.

Thank you @WillowMobileSystems . My idea of scheduled bot was wrong then. I thought scheduled bot will trigger on schedule irrespective of data update.

To clarify, each Data Change type Bot targets a Table. Any time a row in that Table changes, EVERY Bot targeting that Table is โ€œinspectedโ€ to see if should run. Inspection simply means that the Condition is checked.

Scheduled Bots check the condition only when they have reached the target time for running.

In both types of Bots, if the condition is TRUE, the Bot runs, otherwise it does not.

You can, if you set a future trigger time in your record. Even though it does not trigger at the exact time. We can use the method I described above to achieve a somewhat closer time. @Steve

Top Labels in this Space