+ Start a Discussion
TraceyTracey 

Help Building ID Array

 Could somebody please explain to my why this fails?

 

public static ID[] GetAccountContacts(String AccountId)

 {

ID[] iddata = [select id from contact where AccountId];

 

return iddata;

 

}

simhasimha

i want to reterive all valuesof a particular field to the .net.....

 

WebService static Lead[] getfulldetails()
     {
     Lead[] f =[SELECT State from Lead ];
     return f;
     }

 

is it right?plz reply me

jeffdonthemicjeffdonthemic

Tracey,

 

The SOQL query is going to return a list of Contact Sobjects. You'll have to convert that list to a Set/List of IDs yourself depending upon your business case. Take a look at the collection documentation.

 

Your SOQL query should look like the following:

 

List<Contact> myContacts = [select id from Contact where AccountId = :AccountId]; 

 

HTH

 

Jeff Douglas

Appirio

http://blog.jeffdouglas.com 

sforce2009sforce2009

public static ID[] GetAccountContacts(String AccountId)

 {

ID[] iddata;

for(contac c: [select id from contact where AccountId])

{

        iddata.add(c.Id) ;

 }

return iddata;