• Shivam Mishra 4
  • NEWBIE
  • 0 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi all,

I'm trying to complete the challenge for this module but the new "priority" field isn't appearing as an option in the drop-down criteria options... I'm only seeing the stock fields. I've looked at field-level security and even enabled "edit" for everything that was disabled, no dice.



To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.
The Apex class must be called 'AccountHandler' and be in the public scope.
The Apex class must have a public static method called 'insertNewAccount'.
The 'insertNewAccount' method must accept an incoming string as a parameter, name the account after the parameter, insert it into the system and then return the account record.
The 'insertNewAccount' method must also accept an empty string, catch the failed DML and return null.


Getting following Error message :

Challenge not yet complete... here's what's wrong: 
Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account.



Following is the Code written for this ,any help is appreciated to complete the challenge
//

Public class AccountHandler{


public static List<Account> insertNewAccount(String firstname){

Account a=new Account();
a.Name=firstname;   
insert a;


List <Account> queriedaccoutn = [SELECT Name 
                          FROM Account 
                          WHERE Name =:firstname 
                          LIMIT 1];
return queriedaccoutn;
}

}
//