You need to sign in to do that
Don't have an account?
Andy Stollmeyer
Converting Trigger to @future due to SFDC BCC logic
Hi,
I need to convert the below Trigger into an @future, which I have no knowledge of. I tried to simply add the annotation "@future" but apparently you can't pass sObjects to @future methods. I am really stuck here, any help is greatly appreciated!
Trigger
I need to convert the below Trigger into an @future, which I have no knowledge of. I tried to simply add the annotation "@future" but apparently you can't pass sObjects to @future methods. I am really stuck here, any help is greatly appreciated!
Trigger
//TASK TRIGGER trigger TaskTrigger on Task (after insert) { if(Trigger.isAfter){ if(Trigger.isInsert){ TaskTriggerHandler inserter = new TaskTriggerHandler(); inserter.InsertContactUpdateStatus(Trigger.new); } } }Class:
public with sharing class TaskTriggerHandler { public void InsertContactUpdateStatus(List<Task> newList){ set<Id> ctIds = new set<Id>(); set<Id> callIds = new set<Id>(); set<Id> emailIds = new set<Id>(); for(Task t: newList){ String whoId = t.WhoId; if(whoId!=null && whoId.startsWith('003')){ ctIds.add(t.WhoId); if(t.isClosed == TRUE){ if(t.Type != null && t.Type == 'Call'){ callIds.add(t.WhoID); } if(t.Type != null && t.Type == 'Email'){ emailIds.add(t.WhoID); } } } } BUNCH OF ADDITIONAL LOGIC THAT I DONT THINK IS IMPORTANT } }
Please find the modified code here:
Here I considered:
(1) Better way of writing the code.
(2) Modified the if condition in the class.
Thai will help you not only for this issue, even in the future if you get a chance to work on somilar requirement then it is easy to handle it.
Please do let me know if it helps you.
Regards,
Mahesh
All Answers
Trigger: Class:
Please find the modified code here:
Here I considered:
(1) Better way of writing the code.
(2) Modified the if condition in the class.
Thai will help you not only for this issue, even in the future if you get a chance to work on somilar requirement then it is easy to handle it.
Please do let me know if it helps you.
Regards,
Mahesh