Hi,
I am a relatively new Make user on the Core plan.
I have a very simple Scenario that receives a custom webhook, sets variables from the webhook, and then sends an email via Gmail. It works great!
I want the scenario to run every time the webhook receives data. However, the webhook is receiving data and thus the Scenario is running quite often, and I don’t want to receive that many emails. In my mind, the perfect adjustment would be to receive a specific email every 5 times the scenario runs.
Therefore, I added an “Increment function” and router to the Scenario, using the mod math function to perform one action when the increment counter is divisible by 5, and another when it is not.
However, as you can see, I am not able to get the “Increment function” up and running. I’ve searched extensively on these forums but am unable to figure out what I am doing wrong.
Any advice would be greatly appreciated.
Hi,
Welcome to the Make Community!
You need to set up a datastore or connect a database and configure the logic for your scenario.
Make processes each webhook as a separate scenario. Without the mentioned database, you cannot refer to previous execution data.
Please take a look at this article to learn more.
–Update-- As @samliew mentioned below- you can reffer to “increment”. I was to general in my reply because I focused on “Set multiple variables” module.
With the increment module you can. Just set it to NEVER reset and the number will keep incrementing between scenario executions.
Then, to test whether it is every fifth scenario run,
You can add a filter to test the number:
Number {{mod}} 5
Numeric operators: Equal to
0
samliew – request private consultation
Join the unofficial Make Discord server to chat with us!
1 Like
You are completely right.
I focused on “set multiple variables” module visible on the screenshot. I edited the original post to not confuse anyone.
With “set multiple variables,” I assumed that the author wants to store something as variables and use it later. It will be impossible to gather data from 4 previous executions and pass it to the email on the 5th run. A database is necessary in that case.
1 Like
Hi @samliew and @mszymkowiak
Yes, to clarify, nothing that’s set in “Set multiple variables” needs to be referenced or retrieved in a later run.
I just want to keep track of how many times the scenario has been called, which it sounds like Increment function can do.
I do have the Increment function set to reset never, as you can see. However, it still outputs the errors:
Cannot initialize the scenario because of the reason ‘Cannot read properties of undefined (reading ‘reset’)’
Scenario initialization failed with an error.
I got this to work using Data Stores. There’s a separate Scenario where I initialized the relevant value/variable in the data store to 0. I’m still curious why I couldn’t get this to work using Increment function.
In this case you should try just rebuilding your scenario and see if it’s still an issue. If so, might be best to open up a ticket.
1 Like
That’s not supposed to happen. The module in this scenario is corrupted. Delete it and add another new Increment module.
samliew – request private consultation
Join the Make Fans Discord server to chat with other makers!
2 Likes