Hi All,
I’m using the reporting and multitenancy add-on. For some reports I need to use complex native SQL statements in which I need to put in the WHERE clause a filter for the respective tenant_id of the user logged in.
I had the idea to create a header band to retrieve the tenant_id like below:
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.UserSessionSource;
String tenant = AppBeans.get(UserSessionSource.class)
.getUserSession().getUser().tenantId;
return [[ ‘tenant_id’ : tenant]]
Then I try to use the tenant_id in the SQL statement:
…
where tenant_id = ${header.tenant_id}
I get the following error message:
Any idea what I did wrong?