Control what your users can access and save time, money, and frustrations. Lock down sensitive data in SugarCRM or SuiteCRM to specific groups or teams. Supports unlimited assigned users, unlimited group assignments to records, custom layouts for each group, login/sudo capabilities and much more.
#1720 - after_relationship_delete event between user and security group is not working
Hi,
I am facing problem using after_relationship_delete event between user and security group.
When I unlink secuity group from user from user management
I see this unlinking is linked to this file : "include/generic/DeleteRelationship.php" line number "89"
But after that after_relationship_delete event is not running
But when I try to unlink from user bean
$rel_name = 'SecurityGroups';
$user = new User ();
$user->retrieve ( $userId );
$user->load_relationship ( $rel_name );
$user->$rel_name->delete ( $user->id,$securityGroupId);
Please help
5 years ago
Hi there,
I'm not sure how to help here. It sounds like there may be a bug in Sugar that you are running into if the hook isn't firing. One thing to check to be safe is to try doing an after_relationship_delete on a different module and see if that test works. On the SecurityGroups module, try defining the hook on the other module.
5 years ago
it works for all modules when I try to unlink from user bean
$rel_name = 'SecurityGroups';
$user = new User ();
$user->retrieve ( $userId );
$user->load_relationship ( $rel_name );
$user->$rel_name->delete ( $user->id,$securityGroupId);
Its just not working when calling from "include/generic/DeleteRelationship.php" line number "89"
Thanks anyway
5 years ago
Have you tried remove() instead? It will trigger data/Relationships/M2MRelationship.php->remove() which calls the before/after relationship delete hooks.
4 years ago
Closing this out, but feel free to follow up if you have any more questions.