How to trigger a Bot with scheduled event on Partitions ?

Hi Community,

I need to have a Bot that sends a warning email to people of a team of site when a threshold is overpassed.

Each site is a Partition (separated google sheet with the following expression : “USERSETTINGS(Customer Site)”) and have hundreds of them.

I need the Bot to check everyday if the threshold is overpassed in each site and sends an email to each member of the team.

What I need to know is :

  1. is that even possible with AppSheet?

  2. How to set that in the Bot? I have configured a Bot but I’m pretty sure that the Bot is going to check only the original source database and not the Partitions.

Any guidance or ideas is very welcome!

1 Like

I would test this. I think it would be very odd if the Partition wasn’t honored on the server side as well.

2 Likes

I have the same dilemma. I tested a scheduled bot with my app still in Prototype, pressing the Run button in the bot editor:

In this case, it just ran on the original source database.

Knowing that this feature is for the Enterprise plan, I will deploy it and check if, at the scheduled time, the execution may respect the partitioned sources. Hopefully, I can test this out today before I upgrade.

I finished my test with the deployed app, and unfortunately, at least in my case where I use the file partitioning option (different googles sheets files), the scheduled bot does not run on the other sources, only on the original source. Maybe it’s a feature that’s on the roadmap?

Sorry for late response. Out on vacation for past 2 weeks.

I wonder if the “Bypass Security Filter” option on the Bot should be turned on??

1 Like

Hi @WillowMobileSys , Hope you enjoyed your vacation!
I just tried with By Security Pass turned on, and also turned off. But it didn’t succeed:

In signatureUpdateTime we can see that the update worked just now (GMT-3 at 11:36am) :

But in other spreadsheets, the last updta is at 07/28/2023:

Additionally, my partitioning is by different files, through the domain of the user accessing the app, it is directed to its respective file, since I deal with 3 different clients I must protect the information between them. So I followed this good practice:

I would love for this scheduled bot to work between different partitioned worksheets!

I had to use a workaround with Apps Script to unify the 3 spreadsheets in an admin where only I have access and thus run the bot on all my clients.
AppSheet Team, can you hear this request?

Something seems off to me.

It would be a huge oversight and creates a large gap in capability of a multi-tenant app if Scheduled Bots do not operate on the partitions.

Otherwise, the alternative in a multi-tenant app that requires Scheduled Bots is to use a single data table with Security Filters. This is not desired when the critical data needs to be physically separated.

I would ask the question of AppSheet support on how to run a Scheduled Bot on partitioned tables.

I am surprised that this hasn’t been an issue before now. I know there are several multi-tenant apps out there as well as there are other reasons to partition data.

1 Like

I am facing the same issue. My app is partitioned between Market regions TX and TN. we have enterprise standard subscription. This was necessary to address Scalability and performance caused by the large amount of simultaneous data being synced to the app. i have a metrics table that records all the assignments in both market regions and shown as a dashboard. it has an hourly scheduled bot that appends all rows with ids that are not in the table when the bot triggers or updates rows with existing IDS in the table. this worked great until after we partitioned the app and now only is utilizing the TX partition. i am currently using an app script function as a workaround but is limited compared to using a bot. any ideas on why it wouldn’t catch the second partition even though the licensing and everything is correct? i don’t see any prompts to indicate being able to specify partitions in formulas either.

1 Like

BE REVIVED! (Wizard voice)

I am currently facing this issue. Has anyone discovered how to solve this or why it happens? I am running the bot as a check to make sure that old rows are removed from the active partition to keep it as lean as possible. The only idea I have at the moment which is lazy is to put it on the user side. When they add a row to that partition that should trigger the bot to then make a change, but this would really impact with more sync items. IF anyone’s got a better idea to not have my users hate me it would be appreciated :grin: .

If you have several google sheets, you may want to write Google Script in each of those Google Sheets to perform an event on a schedule.

Yeah that ended up being my solution. I’ve got one script that goes to all the partition sheets and removes the rows and pastes them into an archive sheet. keeps the runs low and can be done all at once.

Hi WillowMobileSys,

It seems to be the case. Today, I run again into another project where that feature would be a great advantage. Is there any upgrade or info about this topic that could help ?

Thanks!

Just to paraphrase the issue…When a Scheduled Bot runs it runs only on the first partition.

Your use case is that you wish an automation to run on each partition. In your original post the partitions are divided based on [Customer Site] user setting.

The core of the issue is that a Scheduled Bot runs with its user set as the App Creator. The question is, IF the App Creator account is set to a specific [Customer Site], will the automation then run against that associated partition?

If so, then maybe you could change the App Creator [Customer Site] user setting and run a different Scheduled Bot instance against each partition. While you cannot set the USERSETTINGS() from within the app, they do support App Formulas so I think it may be possible to switch the settings. Maybe it’s not feasible based on the number of partitions?

If that is the case, then it seems, as an alternative solution, you would need to adjust the information so that the data the Bot needs to run against is NOT in a partition at all.

This is the information your Bot was checking. Place these details, necessary to the Bot’s run, in a summarized table that is not segregated. As users interact with the app, these details are kept updated. Then the Bot can run normally on that summary table to perform the checks.

I hope this helps!

Thanks for you quick answer WillowMobileSys !

My current project is slightly different than the one of my original post back in 2023.

In my current project, I made partition so as to scale the amount of data. There is currently 3 partitions : ORIGINAL (this one is empty and is copied for other partitions), 2024 PARTITION and 2025 PARTITION. I need the scheduled BOT to run in 2024 and 2025 PARTITIONs.

I’m very curious about what you mentioned

Could you explain how to set the App Creator account to a specific [field] ?

Thanks a lot !

I just tested this to confirm.

I would setup a User Setting that is visible only to the App Creator account. Implement the App formula to read values from a table.

You should then be able to run the automation while the User Setting is set for your first partition and as a last step set the the table value to the next setting. The User Setting will automatically adjust. Set the second automation to run against the next value and so on.

You could do this with a series of Scheduled Bots set to run at specific times. But you may be able to set this up in a domino fashion such that the Scheduled Bot initially sets the table value which causes a second Bot to trigger automatically on the table setting changes. Then the step which change the table value causes the re-trigger of the Bot for the next partition. This continues until all partitions are run through.

The last piece are the partition settings. I don’t know how you are specifying the partitions for users in your NEW use case by Year. But let’s say, for example purposes, you do have a user selectable User Setting being used. After inserting the App Creator specific User Setting, you could chang ethe partition setting to use an OR expression - If App Creator then use User Setting 2 else use User Setting 1.

OR…

You could you could combine these at the User Settings into User Setting 2 - If App Creator, read from table, else User Setting 1. Then use only User Setting 2 as the partitioning key.

I hope this helps!

Thanks WillowMobileSys, my takeaway is to take advantage of the fact that the Bot will apply in the partition currently used by the App Creator. Based on that, we can imagine strategies to reach each partition.

In one of my App, this is acceptable because a new partition is created each year.

However, I have other Apps with a partition per customer. That represent hundreds of partition. I would be interested in a idea to make a Scheduled Bot running in a hundred of partition (I don’t want to create hundreds of dominos :slightly_smiling_face: )

Thanks a lot for the ideas and food for thoughts