• Amit Jain 5
  • NEWBIE
  • 5 Points
  • Member since 2014
  • Salesforce Dev
  • TriNet


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
The Trailhead challenge is to create a metohd for inseting accounts.

I have the follwing code:

public class AccountHandler {

   public static Account insertNewAccount (String accName){ 

   if(accName!=''){    
       try{
           Account a = new Account(Name=accName);
           insert a;
           System.debug('Account created');
           return a;
       } catch(Exception e){
           System.Debug('Account not created');
           return null;
       }
   } else {
       return null;
   }
  }    
}

This runs fine in Anonyomous window, but when I check the challenge from Trail head it thorws this error:

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.DmlException: Delete failed. First exception on row 0 with id 0019000001duAuoAAE; first error: DELETE_FAILED, Your attempt to delete My Test Account could not be completed because it is associated with the following cases.: 00001066 : []
I keep getting the "Challenge Not yet Complete......... Here's whats wrong"
Lightning page named 'New Account Page' does not appear to have the correct components on it.

The new record page must use the 'Header and Two Columns' template, be called 'New Account Page', and be assigned to the Account object. (Check this is done)
The page must have the Highlights Panel and Twitter components, and a Tabs component with these tabs containing these components: (Check this is done)
Activity Tab contains the Activities Component - Complete
Collaborate Tab contains the Feed Component - Complete
Related Tab contains the Related Lists Component - Complete
Details Tab contains the Record Detail Component - Compelte

Here is a screen shot, I believe I have all the items I am supposed to as well as what goes inside the components.
User-added image
The Trailhead challenge is to create a metohd for inseting accounts.

I have the follwing code:

public class AccountHandler {

   public static Account insertNewAccount (String accName){ 

   if(accName!=''){    
       try{
           Account a = new Account(Name=accName);
           insert a;
           System.debug('Account created');
           return a;
       } catch(Exception e){
           System.Debug('Account not created');
           return null;
       }
   } else {
       return null;
   }
  }    
}

This runs fine in Anonyomous window, but when I check the challenge from Trail head it thorws this error:

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.DmlException: Delete failed. First exception on row 0 with id 0019000001duAuoAAE; first error: DELETE_FAILED, Your attempt to delete My Test Account could not be completed because it is associated with the following cases.: 00001066 : []
As a newby, I'm building a database to manage my real estate business. Looking for someone to review my work and provide guidance to prevent limitations down the road.