+ Start a Discussion
Inna GuptaInna Gupta 

Write SOQL queries Challenge

I am getting 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: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30150000000GzkN. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []

Code is:
public class ContactSearch
{
    public static List<Contact> searchForContacts(String St1, String St2)
    {
        List<Contact> ContctList = [select ID,Name from Contact where LastName = :St1 and MailingPostalCode = :St2];
        return ContctList;
    }
}

Please help!!
Best Answer chosen by Inna Gupta
Raghvendra Singh 22Raghvendra Singh 22
Do you have any Processes active in Process builder? Check there, that may be the culprit.
Setup - > Workflow & Approvals -> Process Builder.

All Answers

Raj VakatiRaj Vakati
Use this code

 
public class ContactSearch {
    public static List<Contact> searchForContacts (String, lName,String, mZip) {
        String lName='Ruiz';
        String mZip='97811';
        Contact[] foundContacts = [SELECT Id,FirstName,LastName 
                                   	FROM Contact 
                                   	WHERE LastName=:lName AND MailingPostalCode=:mZip
                                   	];
        return(foundContacts);
        
    } 
   
}

 
Raghvendra Singh 22Raghvendra Singh 22
Do you have any Processes active in Process builder? Check there, that may be the culprit.
Setup - > Workflow & Approvals -> Process Builder.
This was selected as the best answer
Inna GuptaInna Gupta
Yes, it was the process Builder. I deactivated the process related to contact update and it worked. Thanks a lot for your help.
Raghvendra Singh 22Raghvendra Singh 22
Great , Could you please mark it best answer for other community help
William AdomakoWilliam Adomako
@Raj 
I modified your code this way to make it work for me. Thanks for the guidance.
public class ContactSearch {
    public static List<Contact> searchForContacts(String lName, String mZip){
        lName='Young';
        mZip='66045';
        Contact[] foundContacts = [SELECT Id,FirstName,LastName
                                   FROM Contact
                                   WHERE LastName=:lName AND MailingPostalCode=:mZip];
        return(foundContacts);
                                   
    }
}

I removed excess commas in the arguements line 2
and removed string line 3 and 4