You need to sign in to do that
Don't have an account?
Pravi
want to create utility class which access the data of Custom object with case
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
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
Please follow below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
Please follow below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
Thank you for your help,
i want some more help, i don't understand 3rd point
i need to full fill those points
Input Parameter Case Id, Fetch C_ABC__c from Case using Case ID, Use the ID returned to get the row from ABC__c, Return the List
some thing like that:-
Thanks
Mukesh
i write the following code,
public class Utility {
public static List<ABC__c> CABC (String Name){
Set<Id> caseIds = new Set<Id>(); // store case Id in
caseIds.add(case.id);
List<Case> cList = [Select Id, (Select Id, Name from Vehicle__c(relationshipname) ) From Case Where Id IN: caseIds];
for(ABC__c abc : cList.Vehicle__c) //access ABC__c object details from case
{
List<ABC__c> Vlist = abc.relationshipname;
for(ABC__c abc : cList){
System.debug('ccc : ' + Vlist.ccc__c + ); // like abc.Id ,abc.Name etc
}
}
}
}
now i want to return some field in this utility method,
so i use
List<ABC__c> abc = new <List ABC__c>();
ABC__c pqr = new ABC__C;
pqr.Name = 'ram';
pqr.Year = '2000';
how i return fields without giving some manual data?