public class ActivityUpdate {
public static void updateComments(List<Task> tasklst)
{
set<ID> Appid = new set<ID>();
Map<ID,Application__c> MapContact = new Map<ID,Application__c>();
List<Application__c> contoUpdate = new List<Application__c>();
List<Application__c> con = new List<Application__c>();
for(Task tt:tasklst)
{
if(tt.WhatId!=NULL){
Appid.add(tt.WhatId);
}
Appid.add(tt.WhatId);
if(!Appid.isEmpty())
{
con = [SELECT id,Latest_Act_Recent_Comments__c from Application__c where id IN :Appid];
}
if(!con.isEmpty())
{
for(Application__c c:con)
{
MapContact.put(c.id,c);
}
}
if(!MapContact.isEmpty())
{
for(Task t:tasklst)
{
if(MapContact.containskey(t.WhatId))
{
MapContact.get(t.WhatId).Latest_Act_Recent_Comments__c= t.Latest_Act_Recent_Comments;
contoUpdate.add(MapContact.get(t.WhatId));
}
}
}
if(!contoUpdate.isEmpty())
{
update contoUpdate;
}
}
}
}
Add a comment
|
2 Answers
t.Latest_Act_Recent_Comments
should be t.Latest_Act_Recent_Comments__c
at line 36 as it seems like field on Task object. if it is not created create that as per your logic.
Custom fields are supposed to terminate using __c, so as it seems that Latest_Act_Recent_Comments is a custom field you need to use Latest_Act_Recent_Comments__c .