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
PraviPravi 

want to create utility class which access the data of Custom object with case and return the fields?

My requirement: write a utility class, class name: XYZ, which fetch the data of ABC__c for case by using caseid, case is lookup with C_ABC__c, return some fields of ABC__c, return the list

program:
public class XYZ{
   public static  Map<String,Integer> CC(List<case> CaseIDs){
           Map<String,Integer> yup = new Map<String,Integer>();
           Map<Id, case> caseKeys = new Map<Id, case> (CaseIDs);
           List<Case> cList = [Select Id (Select ABC__c From C_ABC__r) From Case Where Id IN: caseIds];

       for(Case res :cList){         
            List<ABC__c> list = res.Customer_Vehicle__r; //Child Relationship Name
                   for(ABC__c a : vehlist){
                  
                  List<ABC__c> pqr = [SELECT NAME__c,LName__c FIELDS(STANDARD) FROM ABC__c];      
    }
          
   }
 } 
}

My questions:
i fetch case id correctly ?, use for loop or not, i want to return fields i do it correctly? please review and help me
Suraj Tripathi 47Suraj Tripathi 47

Hi Pravi,

Could you mind sharing your question with more clarity, like the things are a bit confusing to understand and the same goes with the code. Kindly share your query with proper details. I'll be happy to assist.

 

Thanks and Regards,
Suraj

PraviPravi
want to fetch the data by using CaseId, objects: case & abc__c lookup c_abc_c  , c_abc_c is lookup with Caseid, and want to fetch some field by using c_abc_c
pass parameter caseid,  fetch c_abc_c from case, return some fields from abc__c ,  return the list

my program: 
public class XYZ {
    public static List<ABC__c> res (Id CaseId){
    
        List<Case> cList = [Select Id, (Select c_abc_c From abc__c) From Case where Id IN: CaseId ]; // by using this not able to fetch caseid
  
          for(Case c : clist){
          List<abc__c> opp = c.abc__r;
          for(Vehicle__c a : vehlist){
          return a;
          }
         } 
 how i fetch the fields ??