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
Maneesh Gupta 11Maneesh Gupta 11 

Apex Basics & Database

I am working on 'Manipulating Records with DML'

I have created this apex class -

public class AccountHandler {
public static string insertNewAccount(string acc_name)
{
account acc = new account ();
try
{
acc.name = acc_name;
insert acc;
} catch (DMLException e) {
system.debug ('DB Error Occurred ' + e.getmessage());
}
ID accid = acc.id;
return accid;
}
}

I am getting the below error - 

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.


Any suggestions?
Best Answer chosen by Maneesh Gupta 11
Jeff DouglasJeff Douglas
Maneesh,

A new DE org should have 2 Salesforce licenses. Go to Setup and do a search for "Company Information". On that page it should tell you how many Salesforce user license you have and used. If you have multiple users you may have to switch the licenses temporarily in order to complete the module.

Jeff Douglas
Trailhead Developer Advocate

All Answers

Jeff DouglasJeff Douglas
The problem is that you are returning the record's id instead of the record itself.

Jeff Douglas
Trailhead Developer Advocate
Maneesh Gupta 11Maneesh Gupta 11
Thanks Jeff! That helped. Got another question  -
Now, am on this module 'Controlling Access to Fields' .. the challenge is asking to create 2 users with Salesforce type license. Unfortunately, with the developer edition, I am not able to create more than one user of this type.
What do I do to complete the challenge?
Jeff DouglasJeff Douglas
Maneesh,

A new DE org should have 2 Salesforce licenses. Go to Setup and do a search for "Company Information". On that page it should tell you how many Salesforce user license you have and used. If you have multiple users you may have to switch the licenses temporarily in order to complete the module.

Jeff Douglas
Trailhead Developer Advocate
This was selected as the best answer
Maneesh Gupta 11Maneesh Gupta 11
Thanks Jeff! I got through :)