I am trying to query Using another class in One custom button. I need to compare one custom pick list value with another object custom field. If that matches, after click on this custom button one popup widow should appear.
global with sharing class PreventWarranty
{
webService static String warranty(ID oppid)
{
Opportunity OppRecord = [SELECT Id, Project_Solution__c, PartnerAccountId FROM Opportunity Where Id =: oppid];
String PartnerAccount = OppRecord.PartnerAccountId;
string ProjectSolution = OppRecord.Project_Solution__c;
date d = system.today().addDays(-180);
List<Accreditation__c> AccredList = [Select Id, Solution_Type__c,Renewal_Date__c from Accreditation__c where
Account__c = :PartnerAccount And
Renewal_Date__c < :d And
Solution_Type__c = :ProjectSolution ];
If(AccredList.size()>0)
return 'Opportunity Number is ' + AccredList;
}
}
Here is my custom button:
I am facing this error at if condition:
Non-void method might not return a value or might have statement after a return statement.
One more error here:
return ''
might work.