0

I have a formula field "leave balance" that uses the Today() function and an accrual rate to calculate the total balance. However, for the accrual rate to work, it has to be manually entered and then calculated with the Today() function.

Is it possible to re-evaluate the formula every month so that the annual leave balance updates automatically? NO CODE PLEASE!

1
  • Formula fields only evaluate when a record is Read. Your question needs elaboration with specific examples.
    – cropredy
    Nov 7, 2016 at 1:26

2 Answers 2

1

The triggering is pretty simple:

  1. Date time Field - Holds the date time you want to trigger
  2. Time Based WFR the is when created and every time it changes
  3. Set the Criteria to be say a field not being null
  4. For the time trigger set it to 0 minutes from #1
  5. After it runs, update the #1 field to the new trigger time

When a TBWFR's time trigger field changes the rule is reevaluated even if the criteria fields did not change. Its a neat little trick.

7
  • Thanks for the response Eric. But how does the existing formula field update after creating this trigger? Nov 6, 2016 at 17:20
  • Formula field are reevaluated overtime the record is touched. Not sure in your specific case since we have no idea what the specifics of the field are. This trigger an update, its up to you to add updates to the fields you required
    – Eric
    Nov 6, 2016 at 17:22
  • I have two objects: Employee and Leave request. The leave balance formula is in the employee object and subtracts number of days rolled up from leave request records. The use case is that as an employee, if I wanted to look at my current leave balance, it would not be updated. Ex. right now my leave balance is 5 days, after I submit leave request its 4 days, but a month later it is still 4 days because the leave balance formula field did not re-evaluate the today() function within the formula. So using your instructions above, how do I trigger that re-evaluation? Nov 6, 2016 at 17:36
  • @HimanshuDhungana - How would you manually get it to update? Figure that out then replicate it with the WFR
    – Eric
    Nov 6, 2016 at 17:39
  • The only way to update would be if I submit a leave request and then the formula triggers upon insert. But its a cross object formula and I need the latest balance before I submit the leave request. WFR doesn't work cross object correct? Nov 6, 2016 at 17:42
1

It turns out the today() function doesn't need to be periodically re-evaluated, so the assumptions of my question were incorrect and the question is invalid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.