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
George FigueroaGeorge Figueroa 

Triggers to reflect future dates

I need to write a trigger which will help me update the field automatically whenever the ETA field contains a future date.

I have information being pulled from multiple fields and would like to pull the information based on the ETA date that reflects a future date 
So far we have the workflow to pull this information but not automatically


User-added image



and it gets pulled into here 

User-added image


as you can see the container information and date reflects the past and this is the only way to pull this information to report on multiple opportunities with multiple containers 
 
Deepak_KumarDeepak_Kumar
Hi George,
You can add these lines/logic inside the trigger.
for(containers_Information__c cInfo:trigger.new){ // containers_Information__c is custom object name
	if(cInfo.container_1_ETA__c > Date.today()){  //container_1_ETA__c date type field
		cInfo.container_1__c = 'SOME VALUE';
	}
	//Same way for other ETA fileds
}

Hope this helps you.
Please mark as solved and also best answer if it will solve your problem.

Regards
Deepak.