• nfon teamuser
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
Hi I have noticed a problem with the Messaging.SingleEmailMessage method. I have this anonymous test code

Messaging.SingleEmailMessage[] emails = new List<Messaging.SingleEmailMessage>();
integer i = 0;
while(i < 10)
{
   i++;
    Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
    mail2.setToAddresses(new String[] {'xxx'});
    mail2.setReplyTo('xxx');
    mail2.setSenderDisplayName('Test');
    mail2.setTemplateId('00XL0000000EBG4');
    mail2.setTargetObjectId('003D000000hv4sd');
    mail2.setWhatId('a0fL0000004foqp');
    emails.add(mail2);
}

Messaging.sendEmail(emails);

In the console I see, that this message is added 10 times to the queue, but I receive only one message and only one message is created in salesforce in the activity history.

In the main code I create emails for different target object and the emails are different inside, but I use the same template for all of them. I have noticed, that only the last email I added to the list is send, the other ones are ignored. This happens only if I use an Template, the I set the body 10 emails are delivered as the should be.

Any suggestions?

Thanks.
Hello,
we are experiencing an code coverage problem on our production environment. Last week we deployed an change set without any issues and the code coverage was at 75%. 3 days later we tried to deploy an other change set, but this has failed do to code coverage error. The code coverage is now at 73%. The problem is, this change contains no code and is only an flow.
There were no changes to any code in those 3 days and no changes to validation rules or work-flows (checked via audit trail), all tests succeed, the only problem is in the coverage. We are generating our test data via factories and using seeAllData=false and aren't using any record in the org for testing.
The code coverage was at 75% at the time of the deployment of the first change set, it would not deploy otherwise. How is is possible, that it is only 73 now?
Classes recompiled, test history deleted, we get the 73% when deploying or running all tests(UI and IDE).

I have found this issue on the forums
https://success.salesforce.com/issues_view?id=a1p30000000T1m1AAC
and have checked the ApexCodeCoverageAggregate, but there is no problem.

I have even tried to validate an change set containing 600 lines of i++; (I know, ugly) and haven't got even 1% more coverage. We are currently using about 2M chars of code.

This is an blocker for us, any help would be appreciated.

Thanks.
Hi I have noticed a problem with the Messaging.SingleEmailMessage method. I have this anonymous test code

Messaging.SingleEmailMessage[] emails = new List<Messaging.SingleEmailMessage>();
integer i = 0;
while(i < 10)
{
   i++;
    Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
    mail2.setToAddresses(new String[] {'xxx'});
    mail2.setReplyTo('xxx');
    mail2.setSenderDisplayName('Test');
    mail2.setTemplateId('00XL0000000EBG4');
    mail2.setTargetObjectId('003D000000hv4sd');
    mail2.setWhatId('a0fL0000004foqp');
    emails.add(mail2);
}

Messaging.sendEmail(emails);

In the console I see, that this message is added 10 times to the queue, but I receive only one message and only one message is created in salesforce in the activity history.

In the main code I create emails for different target object and the emails are different inside, but I use the same template for all of them. I have noticed, that only the last email I added to the list is send, the other ones are ignored. This happens only if I use an Template, the I set the body 10 emails are delivered as the should be.

Any suggestions?

Thanks.
Hello,
we are experiencing an code coverage problem on our production environment. Last week we deployed an change set without any issues and the code coverage was at 75%. 3 days later we tried to deploy an other change set, but this has failed do to code coverage error. The code coverage is now at 73%. The problem is, this change contains no code and is only an flow.
There were no changes to any code in those 3 days and no changes to validation rules or work-flows (checked via audit trail), all tests succeed, the only problem is in the coverage. We are generating our test data via factories and using seeAllData=false and aren't using any record in the org for testing.
The code coverage was at 75% at the time of the deployment of the first change set, it would not deploy otherwise. How is is possible, that it is only 73 now?
Classes recompiled, test history deleted, we get the 73% when deploying or running all tests(UI and IDE).

I have found this issue on the forums
https://success.salesforce.com/issues_view?id=a1p30000000T1m1AAC
and have checked the ApexCodeCoverageAggregate, but there is no problem.

I have even tried to validate an change set containing 600 lines of i++; (I know, ugly) and haven't got even 1% more coverage. We are currently using about 2M chars of code.

This is an blocker for us, any help would be appreciated.

Thanks.