[SalesForce] Formula to populate date field

I have a field called Contract on the lead object. I also have a formula field called 'Contract Number' on the Lead object which should get populated with the Date that the 'Contract' field was populated.

I cannot use Workflow because there is batch apex updating the 'Contract Date' field so it needs to be the formula field I have created. The 'Contract' field will only be updated once and will not change therefore the Contract Date should be the same. Any ideas?

Best Answer

So if I understand correctly, the requirement is this:

A batch will run in the background every hour which will update the Contract field on the lead. When this gets update, the Contract Date field should then be updated with date (TODAY) of when the Contract field gets populated.

So the steps to take are:

  1. create a workflow rule on Lead, triggering only on "created, and any time it’s edited to subsequently meet criteria". Criteria should be: Contract not equal to ''.
  2. add a field update to the workflow rule. The field update should update the Contract_Date field to value TODAY() (use the formula editor to set that value).

That should do it. The workflow will run only once (when the Contract field goes from empty to non-empty).

Related Topic