function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nusrat khowajanusrat khowaja 

Creating an Apex Class

Error
Step not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Either the plain text body or html body must be supplied.: []
Note: you may run into errors if you've skipped previous steps.


 
Shashikant SharmaShashikant Sharma
Hi,

You need to supply body to your email message.

setPlainTextBody(plainTextBody)Optional. The text version of the email, specified by the sender. You must specify a value for setTemplateId, setHtmlBody, orsetPlainTextBody. Or, you can define both setHtmlBody and setPlainTextBody.Signature

public Void setPlainTextBody(String plainTextBody)

Parameters

plainTextBody
Type: String

Return Value

Type: Void

See Example : http://www.salesforcetutorial.com/sending-emails-singleemailmessage/

Read this fro more : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm

 
Miroslav SmukovMiroslav Smukov
There's a problem in the test code for this step, it should be reported to Salesforce team.

Basically, i added the following code to the sendMail function:
public static void sendMail(String address, String subject, String body) {
        System.debug(address + ' | ' + subject + ' | ' + body);  
//rest of function
}
And when I run the "Verify Step" function I got the following output in my log: "DEBUG|null | null | null"

Their test code isn't providing any values to "EmailManager.sendMail" method.
Miroslav SmukovMiroslav Smukov
Just to be more specific, this is a course in Trailhead called "Build a Conference Management App", and the step with an issue is "Creating an Apex Class".

I suggest that anybody facing this issue simply move on to other steps and later come back to this one and try to verify it again. Hopefully the Salesforce team will solve this issue by then.
Miroslav SmukovMiroslav Smukov
The issue with the specific Trailhead module is resolved now, so anybody that faced this issue before and skiped over this module can go to it now and run the "Verify Step" - this time the module should be verified successfuly.
Al PlateAl Plate
Just had the same issue - Feb 2017
Shona WoodburnShona Woodburn
Me too, today 19/02/2017.
mahamed raheemmahamed raheem
me too 
 
Al PlateAl Plate
Please see the thread at https://developer.salesforce.com/forums/ForumsMain?id=906F00000005Hj2  Emma's response on Feb 18 doesn't solve the issue, but it does allow you to complete the challenge.