You need to sign in to do that
Don't have an account?
AwkwardA
Trigger only working before update, not on before insert
I've created the following trigger and it is only updating the task before an update and not before an insert. Help me troubleshoot?
trigger EmailISResponse on Task (before insert, before update) { List<User> InsideSalesUser = [SELECT Id FROM User where UserRoleId='00E30000001rctV']; Set<Id> InsideSalesUserId = new set<Id>(); if (InsideSalesUser != NULL){ for (User u :InsideSalesUser) { InsideSalesUserId.add(u.Id); } } List<Lead> LeadsWithCampaign = [SELECT Id FROM Lead where Current_Teleprospecting_Campaign__c != NULL]; Set<Id> LeadsWithCampaignId = new set<Id>(); if (LeadsWithCampaign != NULL){ for (Lead l :LeadsWithCampaign) { LeadsWithCampaignId.add(l.id); } } for (Task t: Trigger.new) { if(InsideSalesUserId.contains(t.OwnerID) && t.WhoId != NULL && LeadsWithCampaignId.contains(t.WhoId) && t.IsClosed == true && String.valueOf(t.WhoId).startsWith('00Q')&& t.Subject != NULL && String.valueOf(t.Subject).startsWith('Email')) t.IS_Response__c = true; } }
Try this solution,
Let me know if this solved you problem.
mrteles, tried your solution but it's still not working on insert.
Let me know if this solved you problem.