• manoj krishna
  • NEWBIE
  • 204 Points
  • Member since 2014


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 15
    Replies
i have trigger to send email to user after record inserted. but there is error:
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger customerTrigger caused an unexpected exception, contact your administrator: customerTrigger: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Email body is required.: []: Class.CustomerImpl.sendEmailToCustomer: line 11, column 1

Trigger:
trigger customerTrigger on Customer__c (after insert, after update) {
    List<Customer__C> cust=[select name, Email_Address__c,Comment__C from Customer__C];
     for(Customer__C ct:cust)
     {CustomerImpl c=new CustomerImpl();
      c.sendEmailToCustomer();
     }
}

class:
public class CustomerImpl {
    public void sendEmailToCustomer()
       {
           Customer__C cust=new Customer__C();
           Messaging.SingleEmailMessage msg= new Messaging.SingleEmailMessage();
           msg.setToAddresses(new String[]{Cust.Email_Address__c});
           msg.setSubject('info about session');
           msg.setPlainTextBody(cust.comment__c);
           Messaging.sendEmail(new Messaging.SingleEmailMessage[]{msg});
       }
}
Hello,

I am facing below issue while checking App Customization challenage #2.

Challenge Not yet complete... here's what's wrong:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: HMNTOCOG

Can some one look into issue and provide solution for same
Working my way through step 2 of the App Customization superbage and was given this error message. I'm working in a totally new Trailhead Playground environment made especially for this badge and saw no problems with Step 1. Any ideas what could be going on? The error message doesn't give any indication that something is wrong with a specific field or part of the challenge. 

In case it's hard to read, the error id code is BWBZPSLN. I got the same error message earlier with a different id code HNMDZAKT.

Thanks!

User-added image
i have trigger to send email to user after record inserted. but there is error:
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger customerTrigger caused an unexpected exception, contact your administrator: customerTrigger: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Email body is required.: []: Class.CustomerImpl.sendEmailToCustomer: line 11, column 1

Trigger:
trigger customerTrigger on Customer__c (after insert, after update) {
    List<Customer__C> cust=[select name, Email_Address__c,Comment__C from Customer__C];
     for(Customer__C ct:cust)
     {CustomerImpl c=new CustomerImpl();
      c.sendEmailToCustomer();
     }
}

class:
public class CustomerImpl {
    public void sendEmailToCustomer()
       {
           Customer__C cust=new Customer__C();
           Messaging.SingleEmailMessage msg= new Messaging.SingleEmailMessage();
           msg.setToAddresses(new String[]{Cust.Email_Address__c});
           msg.setSubject('info about session');
           msg.setPlainTextBody(cust.comment__c);
           Messaging.sendEmail(new Messaging.SingleEmailMessage[]{msg});
       }
}
I got a public apex class with the following query in it: 
List<Case> jobs;
  String query='select Id, Account.Name, Time__c, End__c, Status, Type, CaseNumber from Case WHERE Time__c != null AND End__c != null';
  String whereStr='';
And below is my test class: 
 
@isTest
class CaseListControllerTest {
    static testMethod void testCaseList (){
    List<Case> cases = new List<Case>();
    for (Integer count = 0; count < 50; count++) {
        cases.add(new Case (Subject='Test', Status = 'Open'));
    }
        
    insert cases;
   
    Test.startTest();
        CalendarController.findAll();
    Test.stopTest();
    Case ACC = [select phone from Account LIMIT 1];
        System.assertEquals ( String.valueOf(ACC.Subject) ,'Test');
    
}
}

Error:
Currently i am receiving: Compile Error: Method does not exist or incorrect signature: CalendarController.findAll() at line 12 column 9

But how would i test for the string query? 

Thanks
 
We're instructed to send an email to the finance group -- that's pretty vague. I'm going to create a Finance group, made up of the CFO and subordinates. Am I missing something in the instructions?
Hello,

I am unable to complete the very basic Install Data.com Assessment App challenge because when I do it automatically signs me in to a previous Salesforce account, even if I access the App Exchange directly from my Trailhead Playground. Thus whenever I try to complete the task it does not find the app on the version of Salesforce it is checking. Please advise.
Hi,

I have written the below classes as part of the trailhead challenge for Apex REST callouts.

The class -

public class AnimalLocator {
  
  public static String getAnimalNameById(Integer id) {
    
    Http http = new Http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/'+id);
    request.setMethod('GET');
    
    HttpResponse response = http.send(request);
    List<Object> animals; 
    String returnValue; 
    
    // parse the JSON response
    if (response.getStatusCode() == 200) {
      Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
      animals = (List<Object>) result.get('animals');
      System.debug(animals);
    }
    
    if (animals.size() > 0 && animals != NULL && id < animals.size()) {
      returnValue = (String) animals.get(id);
    }
    
    return returnValue;
  } 
    
}

Mock Response Class - 

@isTest
global class AnimalLocatorMock implements HttpCalloutMock {
     // Implement this interface method
    global HTTPResponse respond(HTTPRequest request) {
        // Create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');
        response.setStatusCode(200);
        return response; 
    }
}

Test Class - 

@isTest
private class AnimalLocatorTest{
    @isTest static void AnimalLocatorMock1() {
        Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
        string result = AnimalLocator.getAnimalNameById(3);
        String expectedResult = 'chicken';
        System.assertEquals(result,expectedResult );
    }
}

I have got 100% code coverage for the main class. But when I check the challenge I get 

Challenge 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.NullPointerException: Attempt to de-reference a null object

Please tell me if any changes to the code is required. It's really frustrating as I am stuck from past 3-4 days with this unit.

Thanks & Regards,

Abhiram Sheshadri