• Pravi
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
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
  • December 10, 2021
  • Like
  • 0
i want to write a utility class, class name: XYZ, Custom Object Name: ABC__c, Field Name: C_ABC__c
class XYZ access the data from ABC__c but for a Case(Case Object is lookup with field C_ABC__c)
My Understanding: if I want to access data of custom object related to case then i need to fetch the Case ID, if i fetch the Case Id then i get the data related with ABC__c
I Try this:
public class XYZ{ public static List<ABC__c> str(String Name){ List<ABC__c> alist = new List<ABC__c>(); //this line is just for try
List<ABC__c> alist = [Select Id From ABC__c];
} return alist; }

I am stuck, how i access the data ABC__c from Case
  • December 09, 2021
  • Like
  • 0
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
  • December 10, 2021
  • Like
  • 0
i want to write a utility class, class name: XYZ, Custom Object Name: ABC__c, Field Name: C_ABC__c
class XYZ access the data from ABC__c but for a Case(Case Object is lookup with field C_ABC__c)
My Understanding: if I want to access data of custom object related to case then i need to fetch the Case ID, if i fetch the Case Id then i get the data related with ABC__c
I Try this:
public class XYZ{ public static List<ABC__c> str(String Name){ List<ABC__c> alist = new List<ABC__c>(); //this line is just for try
List<ABC__c> alist = [Select Id From ABC__c];
} return alist; }

I am stuck, how i access the data ABC__c from Case
  • December 09, 2021
  • Like
  • 0