Error tenant required in calculation on tenant resource
Hello!
I'm getting an error I don't really know how to solve. It might be a dumb error from my side.
I'm trying to count the number of rows of a resource inside a tenant (the 'items' table) and have it as a calculation on my tenant (the 'project' resource). This way I can know from the outside of the multi-tenancy world how many items are inside a project.
I've added this simple action on the Item resource:
I created a module calculation with this single function (I'm using a code interface for that action):
No matter what I get a Invalid.TenantRequired when I call count items. The project does implement the ToTenant and I also tried passing the tenant string directly (proj_ <> id).
Should I do this stuff in an entirely different way perhaps?
3 Replies
I just noticed now I didn't pass the tenant in the Ash.count(..) function.... -.-
just wanted to say that 😉
does it work? if not you might need to do
It was driving me crazy 😂 well maybe it might be helpful for others in case they use custom actions this will make them look twice if they are passing stuff around correctly
yep it works passing the tenant, I'll try with the scope as well (I've not been using that yet)
Awesome, updated into:
Thanks a lot!