I’ve spent 2 days looking through the source code and can’t find a solution (I’ve been trying some combinations in PostgreSQL)… so I’ll be direct… the idea is not only to limit the workflow activation globally for the entire instance, but to do it per individual user;
how do I find or declare the variable that gives me the logged in user and then compare that user id with the project id each workflow Id belongs to?
If the project id of the user trying to activate the workflow exceeds the limit, only that user should get the error notificación…
** is it possible to do this in this or another way?**
Note: I have already tested the original script and it works very well, I would just like to make the mentioned addition; and suggest that there should be more documentation with examples of Backend and Frontend Hooks.
Storytime
Since nobody answers , I will leave here a simple explanation of what I did thinking outside the box…
I had to combine:
a workflow that accesses postgress and exports a . json file with the workflowId and its respective projectid (from the shared_workflow table, its trigger is “postgresql” every time a new workflow is created it generates the updated file) …
Then to get the projectid of the workflow that is trying to be activated (workflowData.id, with this I get my “binding element” to the account) and that in turn filters all the workflows belonging to the projectId, I had to do this by consulting the Rest API, since dbCollections does not filter “workflowsIds” (an array of only the ids of a project, I noticed that the API does, I feel that dbCollections is very limited, you should put more documentation)…
With all this I managed to filter that only by project (assigned user) consult the workflows that are activated respectively…
Thus allowing not only global limits but also specific users (in this way it is more equitable and I allow, for example, if I have 3 users, that each one can activate 2 workflows, without just one activating 6 and consuming the limit)…
Something similar, I will try to limit the creation so that they can only create 5 but only activate 3 simultaneously).
I hope it helps someone Thank you for your attention.
That seems like a nice solution although I do wonder if there is a better way, Assuming you are using embed did you try reaching out to your sales contact about this as they may have been able to find the answer for you.