I have a trigger to create two tasks in a case.
What I need here is to open a new task when both tasks are closed.
I tried some things and I just got opened a new task if just one of the first tasks is closed. And I need both tasks closed to create a new task.
List<Task> tasks = new List<Task>();
List<Case> cse = Trigger.new;
for (Case c : cse) {
if (c.motivo__c == 'Solicitação de Pagamento' && c.motivo_a__c == 'Laboratório sistema FF'){
Task tsk = new Task
(whatID = c.ID,
Subject = 'Malote',
ActivityDate = Date.today(),
Ownerid = '005U0000000EtIH');
tasks.add(tsk);
This is my first trigger. Works fine. I basically do the same thing to create another task in the same case with the subject = "Lançar PP"
I tried create a new trigger in task to create a new task when "Malote" and "Lançar PP" are closed.
if (t.subject == 'Malote' && t.subject == 'Lançar PP' && t.status == 'Completed'){
Task tsk = new Task
(whatID = t.WhatID,
Subject = 'Baixar PP',
ActivityDate = Date.today(),
Ownerid = '005U0000000EtIH');
tasks.add(tsk);
And this doesn't work.