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
venuraovenurao 

Please Help me on the following Error

my Apex Program as follows

 

public class tatasearch {
public tatasearch()
{
cust=new Customer_Details__c();
}
public Customer_Details__c cust{set;get;}
public List<Customer_Details__c> mySearch()
{
List<List<Customer_Details__c>> searchList=[FIND '{venu rao}' IN NAME FIELDS RETURNING Customer_Details__c(RC_Number__c,Name) LIMIT 15];
return cust;
}
}

 

I got the error on return statement

Error: tatasearch Compile Error: Return value must be of type: LIST<Customer_Details__c> 

 

please help me for this............

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

Change the return type like this

 

public class tatasearch {
public tatasearch()
{
cust=new Customer_Details__c();
}
public Customer_Details__c cust{set;get;}
public List<List<Customer_Details__c>> mySearch()
{
List<List<Customer_Details__c>> searchList=[FIND '{venu rao}' IN NAME FIELDS RETURNING Customer_Details__c(RC_Number__c,Name) LIMIT 15];
return searchList;
}
}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

All Answers

souvik9086souvik9086

public class tatasearch {
public tatasearch()
{
cust=new Customer_Details__c();
}
public Customer_Details__c cust{set;get;}
public List<Customer_Details__c> mySearch()
{
List<List<Customer_Details__c>> searchList=[FIND '{venu rao}' IN NAME FIELDS RETURNING Customer_Details__c(RC_Number__c,Name) LIMIT 15];
return searchList;
}
}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

venuraovenurao

Already I tried this one also ...it's not work out....

souvik9086souvik9086

Change the return type like this

 

public class tatasearch {
public tatasearch()
{
cust=new Customer_Details__c();
}
public Customer_Details__c cust{set;get;}
public List<List<Customer_Details__c>> mySearch()
{
List<List<Customer_Details__c>> searchList=[FIND '{venu rao}' IN NAME FIELDS RETURNING Customer_Details__c(RC_Number__c,Name) LIMIT 15];
return searchList;
}
}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

This was selected as the best answer
venuraovenurao

Thanks Dude.......