function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
B2AB2A 

Trigger (Custom object trigger field update on Account record)

I'm unsure what happened but I am trying to reuse some old code I used for a similar small project, but now I am getting an error when using the Apex Collection "MAP"

 

trigger F2FUpdateAccount on F2F_Meetings__c (after update, after insert) { //Get a LIST of Account IDs SET<ID> setAccountID = new SET<ID>(); string accountID = ''; //if t's whoID is NOT null then it may be an Account that //the task is associate to, and if it starts with '001' then it //definately has to be an Account record! //*** //The for loop below is a SOQL for loop: //- it iterates through the collection of records in the trigger.new array, // which will contain any records either inserted or updated. for(F2F_Meetings__c f: trigger.new){ accountID = f.account__r.id; // AccountID is the Account id setAccountID.add(accountID); // Add to the LIST } //Key-Value pairs (ID, Account) to store mapipng for Account (setAccountID) MAP<ID,Account> mapAccount = new MAP<ID,Account>([Select Id,Last_Face_to_Face_meeting__c From Account Where Id IN : setAccountID]); LIST<Account> accountsToUpdate = new LIST<Account>(); Account a = new Account(); for(F2F_Meetings__c f : trigger.new){ } if(accountsToUpdate.size() > 0){ database.update(accountsToUpdate, false); } }

 

 

 

Here is the error when trying to save this in eclipse (using with a developer edition):

X    Save error: Invalid initial type LIST:SOBJECT:Account for MAP:Id,Account

 

 

I cannot figure this one out.  Any help would be great!