Lookup Key not being Inserted for callStoredFuncWithParams()


#1

I’m trying to use a lookup key called {COMPANY_ID} to provide some multi-tenant features and it seems be be ignored when pushing it through to the stored proc via the REST API as I am getting a cannot convert from varchar to int error (the fk_companyID is an INT).

Is this normal behaviour or is it a bug?


#2

So just got the data back from the Stored Proc without the Lookup Keys, hoping that it will then apply the Lookup Key filter to the SP resultset returned, but it doesn’t seem to be doing that either?


#3

Apologies: callStoredProcWithParams() is the one that I used.


Update custom field when updating role?
#4

Just wanted to post for the benefit of the rest of the community. Lookup key insertion is not support with stored procedures currently. Support for this may be added after the v 2 release.


#5

Just wanted to post my workaround for my particular use-case. So I’m using the lookup keys to give multi-tenancy and I use {COMPANY_ID}. So when executing things with a stored proc or function - the DB is blissfully unaware of the Company and there’s no other way (I think?) to get the lookup key from DreamFactory except for this:

So I have this tblCompany which has the list of all companies- but if I request the table through REST DF as per normal it only every sends me “my” fk_companyID = {COMPANY_ID} so I then do this, cache the value and then it’s available throughout my app for use in the stored procs. i.e. Use normal DF functionality that does use the lookup key to filter responses in order to get those responses “manually”.