• Brian k.ax1387
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I have requirment to update a field on the account page when a salesperson creates a certain type of task.

 

I have it working fine when I don't have the code checking to ensure that the task creator is the account owner. But I get an error that the Account owner is not a variable when trying to compare. See red text.

 

Any thoughts?  

 

trigger AccountVisit on Task (after Insert) {

      Set<id> accountid = new set<id>();

             for (Task tsk : trigger.new){

                        if  (tsk.Type == 'Meeting'){

                            accountid.add(tsk.whatID);

              }

              }

                  List<account> acctlist = [SELECT id

                                           FROM account

                                           Where ID in :accountid];

For (account acc : acctlist && acc.Owner = tsk.CreatedBy)

       {               acc.Last_Formal_Business_Review__c = system.today();

       }           update acctlist

;  }

 

I have requirment to update a field on the account page when a salesperson creates a certain type of task.

 

I have it working fine when I don't have the code checking to ensure that the task creator is the account owner. But I get an error that the Account owner is not a variable when trying to compare. See red text.

 

Any thoughts?  

 

trigger AccountVisit on Task (after Insert) {

      Set<id> accountid = new set<id>();

             for (Task tsk : trigger.new){

                        if  (tsk.Type == 'Meeting'){

                            accountid.add(tsk.whatID);

              }

              }

                  List<account> acctlist = [SELECT id

                                           FROM account

                                           Where ID in :accountid];

For (account acc : acctlist && acc.Owner = tsk.CreatedBy)

       {               acc.Last_Formal_Business_Review__c = system.today();

       }           update acctlist

;  }