Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
Is there a way to combine both these classes(Account & Case)  into one so i there isn't two seperate classes in my org? I'm not sure how to accimplish this and could use help.

Account class

Public Class VF_SiteServicePartnerAllController{

private Account acc;

public List<Site_Service_Partner__c> sspList {get;set;}

public VF_SiteServicePartnerAllController(ApexPages.StandardController sp){

acc = (Account)sp.getRecord();

sspList = new List<Site_Service_Partner__c>();

sspList = [SELECT Id,Name,Site_Account__c,Primary_Field_Contact__c,Service_Partner__c,

Service_Partner_Owner__c,Service_Partner_Owner_Mobile__c,Service_Partner_Owner_Email__c,

Primary_Field_Email__c,Primary_Field_Mobile__c,Service_Partner_Site_Status__c,

Contracted_Services__c,Secondary_Field_Contact__c,Secondary_Field_Email__c,Secondary_Field_Mobile__c,

Service_Partner_Start_Date__c,Service_Partner_End_Date__c,Service_Partner_Main_Phone__c,Trade__c,Supported_Trade__c,trade_value__c FROM Site_Service_Partner__c WHERE Site_Account__c =: acc.Id AND Trade__c IN ('Land', 'Snow', 'Land;Snow') AND Service_Partner_Site_Status__c = 'Active'];

Set<Id> bidId = new Set<Id>();

for(Site_Service_Partner__c bs:sspList){

bidId.add(bs.Id);

}

}

}

Case class

//Used on the Case object updated 1-31-2020

Public Class VF_CaseServicePartExtController{

private Case css;

public List<Site_Service_Partner__c> cseList {get;set;}

public VF_CaseServicePartExtController(ApexPages.StandardController sp){

css= (Case)sp.getRecord();

cseList = new List<Site_Service_Partner__c>();

cseList = [SELECT Id,Name,Case__c,Site_Account__c,Primary_Field_Contact__c,Service_Partner__c,

Primary_Field_Email__c,Primary_Field_Mobile__c,Service_Partner_Site_Status__c, Contracted_Services__c,

Secondary_Field_Contact__c,Secondary_Field_Email__c,Secondary_Field_Mobile__c,Service_Partner_Owner__c,

Trade__c,Supported_Trade__c FROM Site_Service_Partner__c WHERE Case__c =: css.Id AND Trade__c includes('Land','Snow','Land;Snow') AND Service_Partner_Site_Status__c='Active' ];

Set<Id> bidId = new Set<Id>();

for(Site_Service_Partner__c bs:cseList){

bidId.add(bs.Id);

}

}

}

 
2 answers
  1. Apr 8, 2022, 5:26 AM
    Example code? 
Loading
0/9000