How to turn off "Notifying customers of case status changes"

After I setup system email settings, CRM start to send emails to contacts that I used in cases.

That’s not OK for me.

How I can block that feature? Where I can read more about those features?
For now I found some resources, but they didn’t help me to solve a problem


“Introduction to Email Functionality in Sugar”
http://support.sugarcrm.com/Knowledge_Base/Getting_Started/Introduction_to_Email_Functionality_in_Sugar/

“Changing the Status and Notifying a User on Case Update Emails via Workflows”
http://support.sugarcrm.com/Knowledge_Base/Administration/Workflows/Changing_the_Status_and_Notifying_a_User_on_Case_Update_Emails/

“Using Workflows to Notify a Contact When a Case Status Changes”
http://support.sugarcrm.com/Knowledge_Base/Administration/Workflows/Notifying_a_Contact_When_a_Case_Status_Changes/

check you configurations in Admin -> AOP Settings

best regards

1 Like

You was right, but there is some bug/stange feature…

That option is responsible for forwarding emails:

But after I set --None–, it still send emails, where

  1. after I set --None–
  2. before I change template

What I can do to prevent sending emails?

try to disable AOP

best regards

I did that. This can not be done, because after it’s impossible to create case updates.

up

up

Guys, how did you solve a problem with automatic sending emails to contacts if they had been noted in Cases?
I don’t need that feature.

Hi
i have a little similaire issue : https://suitecrm.com/forum/suitecrm-7-0-discussion/10144-aop-and-case-inbound-mail
I receive email update on case create !? Strange behaviour.
I have solve this by change code (not upgrade save) so :
modules/AOP_Case_Events/AOP_Case_Update.php
on line ± 78 i have add a IF

            $userbug = $this->getUser() ;
            if ($userbug->id != 'dfbf9e20-f8aa-0ee5-a3cf-550d456a359a' ){
                $res = $this->sendEmail($emails, $email_template, $signature,  $this->case_id, $addDelimiter,$this->contact_id);
            }

Maybe, you can try to find Contact Template ID and make something like this.
As you can see, i disable email to user configured as inbound email

Regards

1 Like

You helped me to understand in what direction to look. So now I can formilate some advice for troubleshooting for many situation in linux.

You have a problem to fix something, yes? For example let’s take my problem
1)I see that I receive email(that I mentioned before), in that email I see unchangable text: “Please reply above this line”
And I have no idea where it takes it from. But I know what to do, just type in linux CLI:

root@crm-server:~# grep -rl "Please reply above this line" /var/www/suitecrm/
/var/www/suitecrm/include/language/en_us.lang.php

2)Now we know where CRM take that text. In en_us.lang.php I can found that line:

$app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] = '========== Please reply above this line ==========';

That’s mean that CRM use string LBL_AOP_EMAIL_REPLY_DELIMITER in his code.
Now, by that string let’s see where he use it:
root@crm-server:~# grep -rl “LBL_AOP_EMAIL_REPLY_DELIMITER” /var/www/suitecrm/modules/
/var/www/suitecrm/modules/AOP_Case_Updates/CaseUpdatesHook.php
/var/www/suitecrm/modules/AOP_Case_Updates/AOP_Case_Updates.php

3)As had been mentioned before (with little bit mistake) those 2 files send emails. And with my example, without any knowledge in CRM file system, you can find alone crutial files that must be changed.
But let’s continue.
In AOP_Case_Updates.php we found where we use that string:

private function populateTemplate(EmailTemplate $template, $addDelimiter = true, $contactId = null){
        global $app_strings, $sugar_config;
        //Order of beans seems to matter here so we place contact first.
        $userId = '';
        $user = $this->getUpdateUser();
        if(!$user){
            $this->getUser();
        }
        $beans = array("Contacts" => $contactId,"Cases" => $this->getCase()->id, "Users" => $user->id, "AOP_Case_Updates" => $this->id);
        $ret = array();
        $ret['subject'] = from_html(aop_parse_template($template->subject,$beans));
        $body = aop_parse_template(str_replace("\$sugarurl",$sugar_config['site_url'],$template->body_html),$beans);
        $bodyAlt = aop_parse_template(str_replace("\$sugarurl",$sugar_config['site_url'],$template->body),$beans);
        if($addDelimiter){
            $body = $app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] . $body;
            $bodyAlt = $app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] . $bodyAlt;
        }
        $ret['body'] = from_html($body);
        $ret['body_alt'] = strip_tags(from_html($bodyAlt));
        return $ret;
    }

Also we have some code in second file CaseUpdatesHook.php
And I have no idea how to change that code, so it will stop send emails without been broken and cause even more mess. Example that I received from item I don’t understand and that’s why can’t use.

Up. I’m still looking for solution in OP.

Up.
Is there someone who successfully disabled update notifications via emails in Cases?

The Internal update checkbox will stop an update notifying the related contact. If you do not want any emails from relating contacts and closing cases then you can remove the logic hooks from custom/modules/Cases/logic_hooks.php, which are the following:


$hook_array['after_relationship_add'][] = Array(10, 'Send contact case email', 'modules/AOP_Case_Updates/CaseUpdatesHook.php','CaseUpdatesHook', 'creationNotify'); 
$hook_array['after_save'][] = Array(10, 'Send contact case closure email', 'modules/AOP_Case_Updates/CaseUpdatesHook.php','CaseUpdatesHook', 'closureNotify'); 

To do this in an upgrade safe way redeclare the $hook_array[‘after_save’] = Array(); in the extension folder (custom/Extension/modules/Cases/Ext/LogicHooks/anyfilename.php and include the any logic hooks from the logic_hooks.php file which you want to still run. Run a repair and rebuild after doing this.

Thanks.
I did exactly as you told. And CRM stopped send emails when I close the case.

But it keep send emails when I update the case. That’s mean that there is need to change something else.

$hook_array['before_save'][] = Array(10, 'Save case updates', 'modules/AOP_Case_Updates/CaseUpdatesHook.php','CaseUpdatesHook', 'saveUpdate'); 

This points to the function which sends the email. To adjust it to not send an email you would need to create a class CustomCaseUpdatesHook in custom/modules/AOP_Case_Updates/CaseUpdatesHook.php which extends the CaseUpdatesHook class, and write a new function for sendCaseUpdate.

Job done. Thanks a lot for your help.

You told me what to do, but didn’t told me how to change the code.
So I did it in my way.

I found that sendEmail function located in file modules/AOP_Case_Updates/CaseUpdatesHook.php
and it’s opens from line:

     public function sendCaseUpdate(AOP_Case_Updates $caseUpdate){

In that function I found “if” that initiate sending emails with template for them:

        if($caseUpdate->assigned_user_id){
            if($aop_config['contact_email_template_id']){
                $email_template = $email_template->retrieve($aop_config['contact_email_template_id']);
                $signature = $current_user->getDefaultSignature();
            }
            if($email_template) {
                foreach ($caseUpdate->getContacts() as $contact) {
                    $GLOBALS['log']->info("AOPCaseUpdates: Calling send email");
                    $emails = array();
                    $emails[] = $contact->emailAddress->getPrimaryAddress($contact);
                    $res = $caseUpdate->sendEmail($emails, $email_template, $signature, $caseUpdate->case_id, $addDelimiter, $contact->id);
                }
            }

So I deleted that code, and just put “return”:

       if($caseUpdate->assigned_user_id){
            if($aop_config['contact_email_template_id']){
			return;
            }

That solved the problem. And CRM stop send emails. What do you think, that is solution or it make things worse?

Whilst this will solve the issue, it is not upgrade safe. So when you upgrade suite, there is a chance this will be overwritten. To make it upgrade safe you would need to create a file in custom/modules/AOP_Case_Updates/CaseUpdatesHook.php with a class called CustomCaseUpdatesHook which extends CaseUpdatesHook, with a function called sendCaseUpdate in it and you could just return from the function.

1 Like