Skip to main content
added 112 characters in body
Source Link
user24737
user24737

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:

Code Screenshot

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:

enter image description here

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:

Code Screenshot

I am facing this error at if condition:

Non-void method might not return a value or might have statement after a return statement.

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:

Code Screenshot

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:

enter image description here

added 40 characters in body
Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

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:

enter image description hereCode Screenshot

I am facing this error at if condition:

Non-void method might not return a value or might have statement after a return statement.

Non-void method might not return a value or might have statement after a return statement.

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:

enter image description here

I am facing this error at if condition:

Non-void method might not return a value or might have statement after a return statement.

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:

Code Screenshot

I am facing this error at if condition:

Non-void method might not return a value or might have statement after a return statement.

Source Link
user24737
user24737

Non-void method might not return a value or might have statement after a return statement

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:

enter image description here

I am facing this error at if condition:

Non-void method might not return a value or might have statement after a return statement.