Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
447 B
3
Indexable
Never
trigger ganttTrigger on GanttTask__c (before insert, before update) {
    if(Trigger.isInsert){
        for(GanttTask__c gt : trigger.new){
            gt.EstimatedEndDate__c = gt.Start_Date__c + gt.Duration__c;
            gt.EndDate__c = gt.Start_Date__c + gt.Duration__c;
        }
    }
    if(Trigger.isUpdate){
    	for(GanttTask__c gt : trigger.new){
            gt.EndDate__c = gt.Start_Date__c + gt.Duration__c;
        }
	}
}