You need to sign in to do that
Don't have an account?

EMailHeader
Hi champs..
I am very new to salesforce and apex programming.
I am trying to stop an email notification (when case status is set to completed) sent from an apex trigger. I tried setting the EmailHeader.triggerUserEmail = false but it does not seem to work.
is there any other way i can stop this notification.
Thanks in advance.........
Regards,
Din
try to replicate this example as per yor requirement.
trigger Casetrigger on case( before insert)
{
for (Case c : Trigger.New)
{
if (c.status == 'Completed')
{
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerAutoResponseEmail = false;
c.setOptions(dlo);
}
}
}
Please let me know if there is any issue.
Hi Dev,
Thanks for your reply. I have tried the same solution already which is setting the triggerUserEmail to false but this does not work. I do not know if this is a bug in salesforce?
Regards
Hi Dev,
I have tried these three options but no success
triggerUserEmail = false
triggerOtherEmail = false
triggerAutoResponse = false
Regards
Can you please send me the code of your trigger?
Hi,
Thanks for your reply. I am sorry because of the code security I won’t be able to send you the code but I have found another clue in this matter.
We are pushing data to salesforce database through SSIS packages and this SSIS package is setting the triggerUserEmail to true when we push data through the salesforce webservices. I have set this triigerUserEmail to false in SSIS package but I won’t be able to test it until our DBA is back.
Now my question is........
When we set email header options in service call within SSIS packages do they take priority over EmailHeader options that we specify in apex trigger code?
Regards,
Din
Hi,
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerAutoResponseEmail = false;
c.setOptions(dlo);
If the final value of triggerAutoResponseEmail is false then it will work fine otherwise it will not work.
Hi,
The final value is false as I am explicitly setting it to false.
I think DMLOptions are not working as I am expecting them to work.
here is the signature of my trigger
trigger assignCase on Case (before insert, before update)
the following post
http://boards.developerforce.com/t5/Apex-Code-Development/using-DMLOptions-in-trigger-not-working/m-p/124461
suggested people had issues with assignmentRuleHeader and it worked when they combined it with the triggerUserEmail option. So after following the post I tried setting the assignmentRuleHeader to true but still no success. Now I am thinking to raise this with sales force support what do you think?
Regards,
Din
I have created the trigger, but how do i create a test class to get the nessesary code coverage to push it into production?