Skip to main content

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. 

  1. Default value in column
  2. Constant value in domain (dbo.get_tenant )
  3. Expression value in domain (dbo.get_tenant) (which copies to column values)
  4. Expression/query in domain (‘text’)
  5. Calculated field; expression in table 
Domain with expressions - which shows blank in the form. 

 

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!  

Hi,

I'm trying to replicate your challenge but to me it works as intended:

Domain
Column using the domain

Am I doing something different?

Also, this is a way of reusing this, but maybe you can better make use of a Dynamic model procedure that automatically adds this column to every table or just all tables using a particular table tag.