1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Assign to a user from another list

Discussion in 'Standard Support' started by jubranz, Jul 12, 2018.

  1. jubranz

    jubranz New Member

    Level: Community
    Hi, I am a new user, and I have a question please ..

    I want to use Fabrik to manage record logs of client’s complaint calls and assigned it to user team to take action.
    I have created 2 lists:

    1- Team list
    By using juser I can create team users and give them access level.

    2- Calls data list
    Which we record something like call information, number and what is it about .. etc and then assigned it to team user,

    I used (databasejoin element plugin) to choose user from (Team list) and set list access to make the entry edited by only the assigned user, But it is not working. The user still can edit all the records in list.

    When I use (user element) for assigned user field it work, but I can’t use (user element) as I want later to grab some other user information using (databasejoin element plugin) and (Cascadingdropdown element plugin)


    Is there a way to assign to user from another list?
  2. jubranz

    jubranz New Member

    Level: Community
    someone help me please,
    all I want to know is how to assign new entry to a user from a (user list made with juser)?

    I will try to explain it other way..

    for example I have 2 lists:
    list1 = users data made with juser plugin.
    list2= has a form with databasejoin element that connect to (user id and name) from (list1).

    each entry in list2 will be assigned to deferent user to view and edit.
    I try to do that but it doesn't work like when I connect it using (user element plugin).

    could anybody help me please?
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I'm don't understand what the issue is.

    Are you trying to apply access controls on a per-user basis to list2, based on the userid in list 1, using a join on list2 to list1 (so the userid is in list 1, not list 2)?

    -- hugh
  4. jubranz

    jubranz New Member

    Level: Community
    list 1 contain users created by Fabric (I create those user directly from fabric form using juser plugin).
    list 2 contain tasks assigned to those users, where I create new record (task) and assign it to specific user using (databasejoin) to choose from list 1.

    after setting up all access and other things, the user still can't edit the records assigned to him.
    I know that the issue is from assignment databasejoin element, because when I connect (databasejoin) plugin directly to Joomla user database it works just fine, and each user can edit the records assigned to him, but when I connect (databasejoin) plugin to fabric users database which I have created in list1 it renders user name but don't consider him as actual user, thats why user can't edit only the records assigned to him.
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Yup, that's how I would expect it to behave. The "Or user field" ACL expects the field you specify to be a J! user ID. Which a join directly to the J! user table is, or a Fabrik user element is, but a join to another table that contains a user ID is not. Which makes sense when you think about it, as there's no way that code can know which field in the table you are joining to is the one you use to hold the user ID.

    You could probably do it with a pre-filter on list 2, like ...

    Field: id (the primary key)
    Condition: IN
    Value: SELECT id FROM list2 INNER JOIN list1 ON list1.id = list2.list1_id WHERE list1.userid = '{$my->id}'
    Type: query

    Replace the field names accordingly ... list2.list1_id is the join element on list2 to list1. list1.userid is the user element in list1.

    -- hugh
  6. jubranz

    jubranz New Member

    Level: Community
    thank you so much,
    I will try that.
  7. jubranz

    jubranz New Member

    Level: Community
    I try it and it works just fine, it did exactly what I wanted,
    but after several hours I've got this message:
    "500 Fabrik has generated an incorrect query for the list."
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Does the error go away if you remove that pre-filter?

    Did you make any other changes, anywhere in Fabrik?

    -- hugh
  9. jubranz

    jubranz New Member

    Level: Community
    Yes the error goes away if I remove that pre-filter.

    and no, I did not make any other changes anywhere in Fabrik.
  10. troester

    troester Well-Known Member Staff Member

    Level: Community
    IN is not working if the SELECT doesn't return at least one record.

    Does every user have a task assiged?
    Maybe you were logged out ("after several hours"), what did you set for "Apply to"?
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    It won't error out if the subquery returns an empty set. It's not like doing "WHERE id IN ()", with literally an empty parens. Doing "WHERE id IN (SELECT x FROM y WHERE something=whatever)" won't error out if that subquery doesn't return anything.

    -- hugh
    troester likes this.

Share This Page