Question as per title in Sugar 7.6
Question as per title in Sugar 7.6
What do you mean by 'set role'? Do you mean get the role?
You can get the role of a user in a logic hook using:
$rolesArray = ACLRole::getUserRoleNames($current_user->id);
Alternatively ACLRole::getUserRoles($current_user->id);
If you want to set the role, why would you want to set the role in a relationship logic hook? What are you trying to achieve?
What do you mean by 'set role'? Do you mean get the role?
You can get the role of a user in a logic hook using:
$rolesArray = ACLRole::getUserRoleNames($current_user->id);
Alternatively ACLRole::getUserRoles($current_user->id);
If you want to set the role, why would you want to set the role in a relationship logic hook? What are you trying to achieve?
In the Opportunities Contacts relationship (metadata/opportunities_contactsMetaData.php) there is a special relationship field
array('name' => 'contact_role', 'type' => 'varchar', 'len' => '50'),
When I add a relationship the Role field is empty by default. To change it I need to Edit the row in the subpanel.
Instead I would like to set the role in one of the logic hooks choosing one of the options depending on certain conditions.
Otherwise it often happens that users forget to edit and set the field and the logic hook could do the job for them automatically.
Thanks Alan!
I though there might be a way to achieve the same using the Bean instead of direct db query but thanks anyway!