Notifications not working for this code

Hello Team

Help please, My notifications are working fine for Leads Module. But its not working fine Tasks Module i don’t understand why is it so.
Process is Lead is assign to some user ans that user will receive notification that is working fine.
Now lead is convert into account now when i am creating Task for this account assigning to some user that user is not receiving notifcation.
Below is the code:


    if (!defined('sugarEntry') || !sugarEntry) 
    	die('Not A Valid Entry Point');
    class Notification
        function notified($bean , $event, $arguments)
            if ($bean->fetched_row == false) 
	            $url = 'index.php?module=Tasks&action=DetailView&record=';
	            $alert = BeanFactory::newBean('Alerts');
	            $alert->name = 'New Tasks!';
	            $alert->description = $bean->name . ' has been added.';
	            $alert->assigned_user_id = $bean->assign_to_user_c;
	            $alert->is_read = 0;
	            $alert->target_module = 'Tasks';
	            $alert->type = 'info';
	            $alert->url_redirect = $url . $bean->id;
	            $result = $alert->save();

i created one custom relate field assign_to_user_c

have you tried debugging the code? Is it triggered at all? Or did you have a look at the alert table to compare your results with working examples?

I just copied my example code to the tasks module, modified it a little and tested it, seems to work: