i have one custom module 1 with a relate field to another custom module 2.
Based on this field value on module 2 i would add module 1 record to specific security group.
So, i’ve create a many2many relationship between module 1 and security group.
Then add this logic_hook:
// i’m in module one
$targetCompany = $bean->account_id_c; $dm = new DBGIT_DestinationMatrix(); // AKA Module 2 $dm->retrieve_by_string_fields(array('account_id_c' => $targetCompany , 'deleted'=>0 )); $dmsc = new SecurityGroup(); $dmsc->retrieve_by_string_fields(array('id' => $dm->securitygroup_id_c , 'deleted'=>0 )); $bean->load_relationship('SecurityGroups'); $bean->SecurityGroups->add($bean->id); $bean->save(false);
The event is fired well, the record is inserted in table securitygroups_record well but in the related security_group subpanel on module 1 the assigned group has not been added.
I’ve tried also to manually add record for accounts in the same table and it shows well the group…
Is there any other things to do…or…is anything wrong in my logic?