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
Josef LagorioJosef Lagorio 

Cross Object Trigger to update a field on Event

Would there be anyway to update the field on Activity with the field on Campaign? Specific events look up to campaigns and I would like to pull in the industry field from Campaigns to the associated Event. 

Field on Campaign:
Industry (Industry__c)

Field on Activity:
Campaign Industry (Campaign_Industry__c)

 
Suraj PSuraj P
<pre>
if(evt.whatID!=null && evt.WhatId.getSObjectType().getDescribe().getName() == 'Campaign'){
Campaign c = [Select&nbsp;Industry__c from Campaign where Id=:evt.WhatId];
evt.Campaign_Industry__c=c.Industry__c;
update evt;
}
</pre>
Suraj PSuraj P
if my answer helps, please mark it as the best answer