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
WhyserWhyser 

Getting 'Method does not exist or incorrect signature' error

Hi, I'm trying to create a webservice but everytime I try to save it, I'm running into this error (error line highlighted in red below):
 
Save error: Method does not exist or incorrect signature: hasMaintenanceOpportunityProducts(LIST: SOBJECT: OpportunityLineItem)
 
I'll paste my class
 
Code:
global class InvoiceWebService 
{

 webService static Id generateQuote( Id OpportunityId )
 {
  List< OpportunityLineItem > oli = new List< OpportunityLineItem >();
  oli = getOpportunityLineItems( OpportunityId );
  
  Opportunity o = [select id, accountid, type, stageName from Opportunity where id = :OpportunityId];
  
  Account a = [select id, type, customer_id__c, maintenance_expiration_date__c, asp_expiration_date__c from Account where id = :o.AccountId];
  
  if ( o.type == 'Standard' )
  {
   if ( hasMaintenanceOpportunityProducts( oli ) == false )
   {
    // Do something  
   }
  }
  
 }
 
 //////////////////////////////////////////////////////////////
 // Private helper functions for the webservice
 //////////////////////////////////////////////////////////////
 
 private List< OpportunityLineItem > getOpportunityLineItems( Id OpportunityId )
 {
// Reduced the SQL command to allow it to be viewable in this thread. return [select FIELDS from OpportunityLineItem o where o.OpportunityId = :OpportunityId ]; } private Boolean hasMaintenanceOpportunityProducts( List< OpportunityLineItem > oliItems ) { Boolean hasMaintenance = false; for ( OpportunityLineItem oliTemp : oliItems ) { if ( oliTemp.PricebookEntry.Product2.Family == 'Maintenance' ) hasMaintenance = true; } return hasMaintenance; } }

 I've highlighted the method that the webservice is unable to call correctly. I've read the Considerations for using the WebService keyword document, (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_web_services_methods_considerations.htm), but I think I don't quite understand it all that well. Can someone tell me what I'm doing wrong? I have a suspicion that if I fix this part, I will get other similar errors to my other functions.


Message Edited by Whyser on 12-09-2008 09:27 AM

Message Edited by Whyser on 12-09-2008 09:28 AM
mikefmikef
What happens if you change the if statement to this?
Code:
if ( !hasMaintenanceOpportunityProducts( oli ) )
   {
    // Do something  
   }
  }

 

WhyserWhyser
Same error, unfortunately, but thanks for the suggestion.
 
Do you think it's maybe the way I declared my method? Can a webservice method access private methods in the same class? or do I need to declare my private methods in a different manner?