Skip to main content
Lindsey Walgamott が「#Apex」で質問
I need additional help with this:

If you want to copy timezone information from contact to related tasks then write a trigger on Task.

trigger updateTimeZone on Task (before insert, before update) { //Contact Ids Set <ID> contactIDs = new Set <ID> (); for (Task t: Trigger.new){ if (t.whoId != NULL){ contactIDs.add(t.whoId); } } //Create a map to match the task related to ID's with their corresponding account ID's Map<ID, Contact> contactMap = new Map<ID, Contact> ([Select ID, TimeZone__c from Contact where ID in :contactIDs]); //Check contactId and update timezone of the task for (Task t: Trigger.new){ if (contactMap.containsKey(t.whoId)){ t.TimeZone__c = contactIDs.get(t.whoId).TimeZone__c; } } }

Replace TimeZone__c field with the respected fields from contact and task.

**I keep getting this error when I copy and past the trigger you sent me. 

Error: Compile Error: No such column 'TimeZone__c' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 10 column 55

What do I need to do?

What do you mean by replace TimeZone__c field with respected fields contact and task?

Sorry I am new to all of this and trying to figure it all out but just hard for me.

If you could please help me or lead me in the right direction I would greatly appreciate it! 

Thank you-

Lindsey W. 
1 件の回答
  1. 2018年3月8日 14:06
    Hi Lindsey,

    Any update for ur question?

    I would like to know how u solved the exact same problem.

    Regards
0/9000