Skip to main content
Tweeted twitter.com/StackSalesforce/status/1235309226639187977
edited title
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

Messaging.SendEmailResult Type cannot be constructed?

edited tags
Link
Sebastian Kessel
  • 13.2k
  • 12
  • 38
  • 61
added 201 characters in body
Source Link

I'm trying to create a simple mock of messaging Messaging.sendEmail and in my code I'm trying to do the following to construct mocked instances of Messaging.SendEmailResult

Messaging.SendEmailResult result = new Messaging.SendEmailResult();

Compiler is giving the following error:

Type cannot be constructed: Messaging.SendEmailResult

Is there a work around?

Edit:

This doesn't work either:

Type t = Type.forName('Messaging', 'SendEmailResult');
Messaging.SendEmailResult newObj = (Messaging.SendEmailResult)t.newInstance();

Bummer...

I'm trying to create a simple mock of messaging Messaging.sendEmail and in my code I'm trying to do the following to construct mocked instances of Messaging.SendEmailResult

Messaging.SendEmailResult result = new Messaging.SendEmailResult();

Compiler is giving the following error:

Type cannot be constructed: Messaging.SendEmailResult

Is there a work around?

I'm trying to create a simple mock of messaging Messaging.sendEmail and in my code I'm trying to do the following to construct mocked instances of Messaging.SendEmailResult

Messaging.SendEmailResult result = new Messaging.SendEmailResult();

Compiler is giving the following error:

Type cannot be constructed: Messaging.SendEmailResult

Is there a work around?

Edit:

This doesn't work either:

Type t = Type.forName('Messaging', 'SendEmailResult');
Messaging.SendEmailResult newObj = (Messaging.SendEmailResult)t.newInstance();

Bummer...

Source Link
Loading