need defferent DropDown Values for defferent roles


Is it possible to have defferent Values in DropDown for defferent roles? For example.

Role 1 Wil see

Value 1
Value 2

Role 2 Wil see

Value 3
Value 4

I don’t think this is possible without writing some custom code.

You can add a javascript file to the page by editing custom/modules/YourModuleName/metadata/editviewdefs.php to add

‘includes’ =>
0 =>
‘file’ => ‘custom/modules//YourModuleName//js/yourjavascriptfilenamejs’,

Then you’d need to write javascript to update the dropdown on page load, you may need to make an AJAX request to find out the role of the current user.

If you don’t feel confident doing this yourself please feel free to contact SalesAgility for a quote:

1 Like

javascript is a problem, will try to find other way

You possibly could try with a logic hook and a dynamic dropdown

If you set a two level dropdown in which the first is the role and the second is the Value you are looking for this is achievable in an edit view.

Thye logic hook is needed wne you open the edit view so that it selects the value of the first dropdown automatically so that the values of the second dropdown are shown as per your example.

The first dropdown should be hidden in the edit view.

This is just an idea, but you could work on it to find a viable solution

1 Like

Thank you for idea! Will try.

I found somthing ineresting (defferent DropDown Values for defferent USERS), it needs to change for roles (or batter to Securyty Group)

We can take roles for current user

$obj = new ACLRole();
$roles = $obj->getUserRoles($GLOBALS['current_user']->id);

So, this is the answer for my question B)