goodmorning,
in my custom module, I have a relationship with accounts module (primary module: Accounts, and in my custom module I have a field for search account). I would like to set to the record the same security groups associated to the account related. Is this possible? If true, how can I made this?
Thank you so much,
B.
Hi,
You can use Before Save Logic hook in your custom module to get the related group to account record and assign it to this custom record. But this can only be done by an experienced developer. If you are not a developer you can engage someone to do it.
Check this help:
thank you so much,
I try later the solution with Logic Hooks. My last question is: how can retrieve the account’s security groups?
Thank you
B.
Hi,
just run this query and get it
$query=SELECT `securitygroup_id` FROM `securitygroups_records` WHERE `record_id`='your-record-id' AND `module`='Accounts' AND deleted=0
$sec_group_id=$GLOBALS['db']->getOne($query);
Thanks
If you prefer to use the Beans instead of direct SQL access, you’ll find some bits setting Security groups associations here:
–> https://gist.github.com/pgorod/3ce7868a290df0ef4f8c9de74f12a6cd
You basically set a relationship between the record and the security group.