You need to sign in to do that
Don't have an account?
golu
passing a list value from void method
How do i pass the value of list from a static void method to another method.
So basically i want to pass the list of inserted task record values to static void abcd method.
what is the best possible way?
public static void abcd(List<Id> activityIds, String message, Datetime scheduleDateTime){ } public static void createSalesforceActivities(List<Id> recordIdSet ,String message, Datetime scheduleDateTime, String status){ List<Task> lstTask = new List<Task>(); for(String id: recordIdSet){ Task taskObj = new Task(); taskObj.ActivityDate = Date.valueOf(scheduleDateTime); taskObj.Status = status; taskObj.Description = message; taskObj.WhoId = id; lstTask.add(taskObj); } insert lstTask; }
So basically i want to pass the list of inserted task record values to static void abcd method.
what is the best possible way?
All Answers
Greetings to you!
Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
i want public static void abcd(List<Id> activityIds, String message, Datetime scheduleDateTime) to take the parameter values from lsttask list. Is there a way to do it ? String message and schedule datetime will remain the same for all the records. only difference will be list<id> .