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
Yogesh Dighe.Yogesh Dighe. 

Any problem in my SOQL Apex code.?

public class ContactSearch
{
    public static List<Contact> searchForContacts(String s1, String s2)
    {
        String lnam = s1;
        String mpc =s2;
        Contact[] conlist = [SELECT ID, Name FROM Contact WHERE (LastName=:lnam AND MailingPostalCode=:mpc)];
        List<Contact> conts = new List<Contact>();
        conts = conlist;
        return conts;
    }
}


Above code cant gives me any error in my developer console, so why i cant completing the my Trailhead challenge succefully.??
it gives me following 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: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Error....: [] "

 
Best Answer chosen by Yogesh Dighe.
Yogesh Dighe.Yogesh Dighe.
@Pratik :-

Thanx,
you r right, and no need to try in other fresh DE.
actually my one trigger is giving me that problem, Then m just Inactive all my trigger which acts on Contact.
i got it now, m completed now my trailhead challenge :)

All Answers

PratikPratik (Salesforce Developers) 
Hi Yogesh,

Thanks for the feedback. Our internal team will help you to resolve this issue.

Thanks,
Pratik
 
Yogesh Dighe.Yogesh Dighe.
feedback.??
i was asked quesion.
how can i resolve that problem.??
help me
 
Vijay NagarathinamVijay Nagarathinam
Hi Yogesh,

Try this code.
 
public class ContactSearch
{
    public static List<Contact>searchForContacts(String lastName,String mailingPostalCode)
{
        List<Contact> contactList=[SELECT Id,FirstName,LastName,MailingPostalCode FROM Contact WHERE LastName=:lastName AND MailingPostalCode=:mailingPostalCode];
            return contactList;
            }
}

 
Yogesh Dighe.Yogesh Dighe.
@ vijay - NO, your code is also not working :( it cant allows to me complete my trailhead challenge :(
PratikPratik (Salesforce Developers) 
Hi Yogesh,

Seems to be issue with De org, can you please try this on new/fresh DE org and let us know if you face any issues.

Thanks,
Pratik
Yogesh Dighe.Yogesh Dighe.
@Pratik- Yes, i was also try above code in different DE there was no any problem to run that code. so my main problem is, how can i complete my TRAILHEAD challenge.????????
Yogesh Dighe.Yogesh Dighe.
@Vijay :-
I also just past your code, Still i geting the following error.. How can i complete my TRAILHEAD challenge.???
User-added image
PratikPratik (Salesforce Developers) 
Hi Yogesh,

I can understand your problem as it;s not allowing you to complete the challenge. Is there any validation rules or any other rules that are conflicting? Also as i mentioned in my above post have you tried it in fresh DE org?

Thanks,
Pratik
Yogesh Dighe.Yogesh Dighe.
@Pratik :-

Thanx,
you r right, and no need to try in other fresh DE.
actually my one trigger is giving me that problem, Then m just Inactive all my trigger which acts on Contact.
i got it now, m completed now my trailhead challenge :)
This was selected as the best answer
PratikPratik (Salesforce Developers) 
Glad it helped! Thanks, Pratik