I want to assign a security group on creation to a contact.
I am using SuiteCRM 8.2 and looked at the workflow module but I cannot manage to assign it to a security group.
Create the Logic Hook Class: Inside the same custom directory, create a new PHP file named custom/modules/Contacts/AssignSecurityGroup.php. This file will contain the logic for assigning the security group
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class AssignSecurityGroup
{
function assignSecurityGroupToContact($bean, $event, $arguments)
{
// Check if it's a new record
if ($bean->isNew()) {
// Set the security group ID as per your requirement
$securityGroupId = 'your_security_group_id';
// Assign the security group to the contact
$bean->acl_team_set_id = $securityGroupId;
}
}
}
4. Repair and Rebuild: After creating the logic hook, navigate to the Administration panel, go to Repair and click on “Quick Repair and Rebuild” to apply the changes