+ 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 
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.