So With the following trigger I wrote, I get an error on the line that says Trigger.oldMap( t1.Id ).IsClosed: The error is

"Variable does not exist: Trigger"

Which seems very odd to me, can anyone see what I'm doing wrong?

trigger TaskStatusChanged on Task ( after update ) {

    // For all the tasks that have been updated
    for( Task t1 : Trigger.new ) {

        // If this task has been closed or opened
        if( t1.IsClosed != Trigger.oldMap( t1.Id ).IsClosed ) {

            // If the task has been closed
            if( t1.IsClosed ) {
                 // Stuff

            // If there aren't any other open tasks, then update the Case object.
            if( !otherOpenTasks ) {


       // If the task has been opened
       else if( !t1.IsClosed ) {
           // Stuff

       // If the Task doesn't have an IsClosed value
       else {
           // do nothing

2 Answers 2


The syntax is not correct. You have no Get call.





It should be Trigger.oldMap.get(t1.Id).IsClosed. Because you left out the function get, Apex Code's scope resolution first tried to find a function called oldMap on the class Trigger, which doesn't exist, so it then tried to find a variable called Trigger, which also doesn't exist.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .