Description:
I am trying to automate a scenario that creates a task in ClickUp whenever a product reaches its minimum stock level. The data comes from Bling ERP (using an HTTP request) and Google Sheets (which stores the minimum stock levels).
Scenario Setup:
HTTP Request (Bling ERP) → Retrieves a list of all products and their stock levels.
- Example output:
{ "data": [ { "id": 16435139760, "nome": "Product A", "estoque": { "saldoVirtualTotal": 5 } }, { "id": 16429068309, "nome": "Product B", "estoque": { "saldoVirtualTotal": 12 } } ] }
Google Sheets - Get Range Values → Retrieves the minimum stock levels for each product.
- Example output:
[ { "ID": 16435139760, "ESTOQUE MÍNIMO": 10 }, { "ID": 16429068309, "ESTOQUE MÍNIMO": 15 } ]
Array Aggregator → Groups the stock minimums by product ID.
- Output structure:
[ { "ID": 16435139760, "ESTOQUE MÍNIMO": 10 }, { "ID": 16429068309, "ESTOQUE MÍNIMO": 15 } ]
Filter → Should allow only products where
saldoVirtualTotal <= ESTOQUE MÍNIMO
to proceed to ClickUp.
Issues Encountered:
Problem 1: The filter only compares the first product in the dataset.
- Instead of correctly matching each product’s stock level with its corresponding minimum stock level, the filter repeats the first product’s stock for all comparisons.
- Filter condition used:
get(1.Data; 14.Array[].ID).estoque.saldoVirtualTotal <= get(14.Array; 14.Array[].ID).D
- This causes incorrect comparisons and blocks all or allows all products.
Problem 2: Infinite Loop Occurs when Using Iterator
- Initially, I used an Iterator after the HTTP request to split the products, but this caused the scenario to loop indefinitely and repeatedly create duplicate tasks in ClickUp.
- Removing the Iterator fixes the loop but brings back Problem 1, where the filter only checks the first product.
Problem 3: The Filter is Processing More Bundles Than Expected
- The Filter Inspector shows that it processes 63 bundles (same as the number of products retrieved).
- However, when filtering, it does not correctly match the stock levels for each individual product.
What I Need Help With:
How can I correctly filter products without using an Iterator, while ensuring that each product’s stock level is correctly matched to its minimum stock level?
Is there a better way to compare stock levels in Make without causing the filter to only use the first product in the dataset?
How can I optimize this scenario to avoid excessive executions (since I am on the free plan with only 1000 operations/month)?
Any help or alternative approach is greatly appreciated!
This should clearly explain your issue to the community. Let me know if you need any modifications before posting. Good luck!