• Thangamani Nachimuthu 6
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies
Hi Devi Chandrika,
   Now i am trying for another trailhead challenge and below is my problem statement and my code and error as well.Kindly suggest me.
The Apex class must be called ContactSearch and be in the public scope
The Apex class must have a public static method called searchForContacts
The method must accept two incoming strings as parameters
The method should then find any contact that has a last name matching the first string, and mailing postal code (API name: MailingPostalCode) matching the second string
The method should finally return a list of Contact records of type List that includes the ID and Name fields

My Code:
public class ContactSearch {
    public static contact[] searchForContacts(string lstName,string mpostalcode)
    {
        contact[] cts = [SELECT FirstName,LastName,ID
                          FROM Contact WHERE LastName=:lstName AND mailingpostalcode=:mpostalcode];
            
            return cts;
        
    }

}

I am getting the below error in trailhead challenge.
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Loan_Amount__c]: [Loan_Amount__c]

Kindly suggest me.

Regards,
Thangamani
Hi Team,
   Kindly let me know Query Editor tab in the Developer console where i am not finding the option to execute my SOQL.

Regards,
Thangamani
Hi Experts,
  Pls help me to solve the below issue.I am trying to take a trailhead challenge and i have created the below class and it is working fine able to create the account ,but when i am checking the challenge completion i am getting the error.

public class AccountHandler {
      public static Object insertNewAccount(String strNames)
      {
          try
          {
          Account acct = new Account();
            acct.Name = strNames;
            acct.Phone = '(415)555-1212';
            acct.NumberOfEmployees = 100;
        insert acct;
        //ID acctID = acct.Id;
// Display this ID in the debug log
//System.debug('ID = ' + acctID);
              return acct;
          }
          catch(DmlException  ex)
          {
              System.debug('Got the Error:' +ex.getMessage());
              return null;
          }
      }

}

Challenge not yet complete in My Trailhead Playground 1
Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account.
Hi I am trying to write a Apex class to create an account and return the record name and i am getting the below error:
Static method cannot be referenced from a non static context: String
Here is my Code:
public class AccountHandler {
      public static String insertNewAccount(String strNames)
      {
          try
          {
          Account acct = new Account();
            acct.Name = strNames;
            acct.Phone = '(415)555-1212';
            acct.NumberOfEmployees = 100;
        insert acct;
        ID acctID = acct.Id;
// Display this ID in the debug log
System.debug('ID = ' + acctID);
              return strNames;
          }
          catch(Exception ex)
          {
              return 'NULL';
          }
      }

}
Hi Team,
I would like to add my blogs in the community and kindly let me know the options.

Regards,
Thangamani
Hi Team,
What is the step by step for the creation of the personal views/dashboards/charts?

Regards,
Thangamani
Hi Team,
 What are the parameters considered for the lead scoring?

Regards,
Thangamani
Hi Devi Chandrika,
   Now i am trying for another trailhead challenge and below is my problem statement and my code and error as well.Kindly suggest me.
The Apex class must be called ContactSearch and be in the public scope
The Apex class must have a public static method called searchForContacts
The method must accept two incoming strings as parameters
The method should then find any contact that has a last name matching the first string, and mailing postal code (API name: MailingPostalCode) matching the second string
The method should finally return a list of Contact records of type List that includes the ID and Name fields

My Code:
public class ContactSearch {
    public static contact[] searchForContacts(string lstName,string mpostalcode)
    {
        contact[] cts = [SELECT FirstName,LastName,ID
                          FROM Contact WHERE LastName=:lstName AND mailingpostalcode=:mpostalcode];
            
            return cts;
        
    }

}

I am getting the below error in trailhead challenge.
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Loan_Amount__c]: [Loan_Amount__c]

Kindly suggest me.

Regards,
Thangamani
Hi Experts,
  Pls help me to solve the below issue.I am trying to take a trailhead challenge and i have created the below class and it is working fine able to create the account ,but when i am checking the challenge completion i am getting the error.

public class AccountHandler {
      public static Object insertNewAccount(String strNames)
      {
          try
          {
          Account acct = new Account();
            acct.Name = strNames;
            acct.Phone = '(415)555-1212';
            acct.NumberOfEmployees = 100;
        insert acct;
        //ID acctID = acct.Id;
// Display this ID in the debug log
//System.debug('ID = ' + acctID);
              return acct;
          }
          catch(DmlException  ex)
          {
              System.debug('Got the Error:' +ex.getMessage());
              return null;
          }
      }

}

Challenge not yet complete in My Trailhead Playground 1
Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account.
Hi I am trying to write a Apex class to create an account and return the record name and i am getting the below error:
Static method cannot be referenced from a non static context: String
Here is my Code:
public class AccountHandler {
      public static String insertNewAccount(String strNames)
      {
          try
          {
          Account acct = new Account();
            acct.Name = strNames;
            acct.Phone = '(415)555-1212';
            acct.NumberOfEmployees = 100;
        insert acct;
        ID acctID = acct.Id;
// Display this ID in the debug log
System.debug('ID = ' + acctID);
              return strNames;
          }
          catch(Exception ex)
          {
              return 'NULL';
          }
      }

}
Hi Team,
I would like to add my blogs in the community and kindly let me know the options.

Regards,
Thangamani
Hi Team,
 What are the parameters considered for the lead scoring?

Regards,
Thangamani