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
Synthia B.Synthia B. 

Apex Trigger or Workflow Rule (Dates) ?

I am not sure how to go about creating the best solution for the senario below. 

If Signed_By_Client__c date is > Signed_by_Vendor__c  date, populate date in Executed_Date__c field 
If Signed_By_Vendor__c date is > Signed_By_Client__c date, populate date in Executed_Date__c field
If Signed_by_Vendor__c date and Signed_By_Client__c date is = to each other,  Executed_Date__c field will be either of the 2  

The executed field must contain the latest date of the two fields. 

Thanks in advance!

Thanks in advance! 

Best Answer chosen by Synthia B.
Neetu_BansalNeetu_Bansal
Hi Synthia,

You can create a formula field to achieve this: 
Formula would be like:
IF( Signed_By_Client__c >= Signed_by_Vendor__c , Signed_By_Client__c , Signed_by_Vendor__c )
Let me know, if you need any other help.

Thanks,
Neetu

All Answers

vibhor goelvibhor goel
Hi Synthia,

Since everytime u need to update the value in the same field i.e. Executed_Date__c , then it is possible to achieve this by using a simple workflow rule with a field update if all the fields are from the same object .

In the workflow you can check the conditions and based on them get the value which needs to be updated in that field.

Hope it helps.

Regards,
Vibhor

 
Synthia B.Synthia B.
Thank you Vibhor. I will start on the workflow rule and let you know how it goes. 
Sanpreet SainiSanpreet Saini
Process builder seems to be fair choice as it can handles multiple conditions seperately. 

https://help.salesforce.com/HTViewHelpDoc?id=process_overview.htm

Regards, 
Sanpreet
Neetu_BansalNeetu_Bansal
Hi Synthia,

You can create a formula field to achieve this: 
Formula would be like:
IF( Signed_By_Client__c >= Signed_by_Vendor__c , Signed_By_Client__c , Signed_by_Vendor__c )
Let me know, if you need any other help.

Thanks,
Neetu
This was selected as the best answer