AnsweredAssumed Answered

logic hook for when a user is assigned to a record

Question asked by Robert Sinclair on Nov 22, 2018
Latest reply on Nov 28, 2018 by Robert Sinclair

Hello

 

I want to trigger an action when a new user gets assigned to a record (by default it's assigned to "admin"). I'm trying the after_relationship_add hook, but it's not working.

 

Should I even be using the "after_relationship_add" hook at all? It looks like the user, is just a field and is not related to the "user" module... So if we assign a user to a record, is that considered as a relationship adding?

 

 

Registered it using:

$hook_array['after_relationship_add'] = Array();
$hook_array['after_relationship_add'][] = Array(
77,
'changes status of inventory unit when a new user gets assigned',
'custom/inventory/relationship_check_c.php',
'relationship_check_c',
'relationship_check_c');

And the hook code is:

class relationship_check_c {
   
    function relationship_check_c($bean, $event, $arguments) {

        $GLOBALS['log']->info('Executed relationship_check_c logic hook');

    }

}

Outcomes