Skip to main content
sairam v perguntou em #Trailhead
I tried with below code but i am getting some error message .

Create an Apex class that returns contacts based on incoming parameters.?

public with sharing class ContactSearch {

    public static List<Contact> searchForContacts(String lastName,  String postalCode) {

        return [ select Name from Contact where LastName = :lastName and  MailingPostalCode = :postalCode ];

    }

}

 
10 respostas
  1. 12 de set. de 2016, 09:54
    Sairam,

    How about trigger?Any active triggers on contact object?

    Try this code

    public class ContactSearch {

    Public static List<Contact> searchForContacts(String name,string PosatalCode)

    {

    List<Contact> Contacts=new List<Contact>();

    Contacts=[select id,name from contact where name=:name or MailingPostalCode=:PosatalCode];

    return Contacts;

    }

    }

    Thanks.