Anyone know how to disable assignment notification JUST for a custom module?

I’m working on a SalesActivity module where I write a record for each sales related call, email, meeting and task. It works great so far and gives much much richer reporting abilities than reporting on all this stuff separately. However, my one remaining issue is that assignment notifications are sent for each created record. I don’t want to turn off all assignment notifications (I know how to do that) I only want to turn off for the specific module. I’ve read a few posts about this but none seemed to have worked for me.

Anyone ever done this?

Hey
the “_sendNotifications” function in the data/SugarBean.php file sends out assignment notifications
you can override this function for your specific module (In the bean file of that module ) to return immediately which will disable sending out notifications

That one is private, can’t be overriden. But the one it calls can -

send_assignment_notifications

There is an example of a module overriding it in modules/Meetings/Meeting.php

1 Like

thanks @pgr and @abuzarfaris for you input. I’m going to give that a try and post the solution if I can get it to work.

I’ve tried a bunch of coding solutions trying to extend save() and set notify to false, also send_assingmnet_notifications to false, nothing seems to work!

Also tried a before save hook and and after save hook. Can’t believe this is this hard!

I also found this little gem which is super interesting, but alas doesn’t work either!

Description Allows an administrator to explicitly disable modules from sending assignment notifications to users.
Type Boolean
Range of values true and false
Versions 5.2.0+
Products Professional, Enterprise, Ultimate, Serve, Sell
Default Value false
Override Example ```
$sugar_config[‘exclude_notifications’][‘module’] = true;

Ok so almost there! Need a little help.

in module/act_actvities/act_activities.php

I can add:

public function save($check_notify = false)
			{
				
				// Logging the variable dump
				//$GLOBALS['log']->fatal("Custom save() function - Bean Dump: " . print_r($this->bean, true));

				return parent::save();
			}

In the act_activities class (which extends Basic, which extends Sugarbean) and it totally works prevents the email from being sent.

However, want to make this upgrade safe. When I create a file:

custom/modules/act_activities/act_activities.php

Like this…

<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not a valid entry point.');
}

require_once 'modules/act_activities/act_activities.php';

class CustomActActivities extends Basic {

    public function save($check_notify = false)
			{
				
				// Logging the variable dump
				//$GLOBALS['log']->fatal("Custom save() function - Bean Dump: " . print_r($this->bean, true));

				return parent::save();
			}

}

It doesn’t work. I also tried extending act_activities and it didn’t work either. What am I doing wrong here?

You should go to the file ‘modules/act_activities/act_activities.php’

within the class
act_activities

define a function like this

public function send_assignment_notifications($notify_user, $admin)
    {

    }

Basically an empty function and this will stop sending notifications for this module

1 Like

thanks @abuzarfaris That’s what I did (using the other function) it totally works stopping the emails if I add it in the /module/act_activities/act_activities.php. However, I want to make it upgrade safe by adding it to /custom/… but it doesn’t seem to work if I add it there. Am I doing something wrong with how I’m calling it in the custom folder?

If it’s a custom module it’s already upgrade safe

1 Like

I was just thinking about that and yes you’re right, it won’t get over-written.