You need to sign in to do that
Don't have an account?
Everton CP7
Task OwnerID
I'm trying to add an specific OwnerID to an specific task.
But I couldn't query my others tasks.
I'm trying to select the OwnerID from task "1X".
And put in the task "3X" when I complete the task "2X".
trigger CriarTarefa_Nova_separacao on Task (after update) { List<Id> creatorIds = new List<Id>(); for (Task task : Trigger.new) { if (task.Status == '1X') { creatorIds.add(task.CreatedById); } } List<Task> creators = [Select Id, CreatedById from Task Where Id in :creatorIds]; Map<Id,String> creatorIdsTo = new Map<Id,String>(); for (Task creator : creators) { creatorIdsTo.put(creator.Id,creator.CreatedByID); } List<Task> taskNova = new List<Task>(); for (Task tt : Trigger.new) if (tt.subject == '2X' && tt.status == 'Completed'){ taskNova.add (new Task( Subject = '3X', Status = 'Nenhum', WhatID = tt.WhatID, Description = tt.description, OwnerId = creatorIdsTo.get(tt.CreatedById), ActivityDate = Date.today())); }
insert taskNova;
}
My error is:
"Assigned to: Assigned to ID: owner can not be blank"
Thanks !
All Answers
Still giving me the same error.
Owner's first task is the same owner's case.
Maybe if a create an map to pull the owner's case.
Can you help me?
I changed a few steps and works.
Thanks for help Naidu.