I really appreciate your help. New to Stack Exchange and also coding
Use case:
If at least 3 key fields (firstname, lastname and website)are populated, create a new Task for each key field populated:
The name of each Task should be: Verify the (key field name) field.
I can create one task but I am not sure how to create three task for each field.
Not completed code: I created a custom field Key_Fields_Populated__c on lead. Wrote a trigger which counts the fields populated. Now I want to create task for each key field populated. So in this case three tasks.
Where I am stuck is "the name of each task should be: verify the (key field name) field. Below is my helper class:
public class keyFieldsPopulatedHelper {
List <task> TaskLead = new list <task>();
public static void keyFieldsPopulatedHelperMethod(list<Lead> LeadList){
for(Lead L: LeadList){
if(L.Key_Fields_Populated__c >= 3){
for(integer i = 0; i >= 3; i++){
Task T = New Task();
T.WhatId = L.Id;
}
}
}
}
}