You need to sign in to do that
Don't have an account?
Abby Stocker
Code ideas needed!
Hello! I have created an apex class (below) that will get the current case Id. Now I need another class on Task that will get all tasks related to that current case record and store them in something (a list?). That way, I can use both of those apex classes in a trigger. Any idea on how to write the class on Task (get a list of all tasks related to the current case record Id)? I know i need to use Id and Whatid but I am just not sure how to format it out. Thank you!!! (getcurrentrecord code below).
public class currentCaseRecord {
Case currentRecord;
public currentCaseRecord (ApexPages.StandardController controller){
currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
}
public case getcurrentRecord(){
return currentRecord;
}
}
public class currentCaseRecord {
Case currentRecord;
public currentCaseRecord (ApexPages.StandardController controller){
currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
}
public case getcurrentRecord(){
return currentRecord;
}
}
List<Task> tasks = [SELECT id, subject from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id')];
All Answers
List<Task> tasks = [SELECT id, subject from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id')];