I am experimenting with multitenancy options. Currently I have a user table, and here a Tenant is set.
When that user opens a table, a mandatory prefilter filters on Accounts with a matching tenant_id. This way, the user will only his accounts. Works ok.
When this users Adds a new account, I need to save the users tenant, in the account record.
I added a field with Default Value type: Expression - and then the expression is;
select dbo.get_tenant()
So far, still good.
but, now I need to add this expression in all tables/columns where I need this.
So I thought of making a Domain, with an expression set there. Feels more efficient.
However, it doesn't show a thing!
Here I have create 4 columns.
- Default value in column
- Constant value in domain (dbo.get_tenant )
- Expression value in domain (dbo.get_tenant) (which copies to column values)
- Expression/query in domain (‘text’)
- Calculated field; expression in table
So, why can I not set a query (in my case the get_tenant function) in the default value or expression in the domain?
When i set a domain default value something like 'text’ - it also copies to the column default value, and works. With my select get_tenant it does not copy, and does not work.
Also, when changing the domain, that new value is not overwritten in the column default value.
Ergo, I don't really get it.
Any pointers on how this needs to be interpreted and should work?
Thanks!