0

How can I create recurring time-based field update (action) in my Work Flow rules?

e.g. for the next 30 days, I want to increment a date field with + 1 Day.

I know this could be done by simply creating a time-based action for EACH day but I am seeking a more cleaner way than inserting 30 actions into my Work Flow.

0

You could try this way :

  1. Create a new date field "Tech Next Date Workflow fire"
  2. Create a time based workflow to increment your date with 1 day "0 hour after Tech Next Date Workflow fire"
  3. Create a second workflow that update the "Tech Next Date Workflow fire" with one day when your date is updated (-> by first workflow)

Then, your time based workflow will update your date, and will be automaticaly restarted one day after. If you want to do it only during X days, you can create an other field to count how many times workflow 1 has been fired, and add a filter.

It seems a bit tricky but it works and should resolve your problem without doing apex.

  • I think I understand how this works... Just so we're clear: So I have WORKFLOW1 which when triggered (on certain stage) will update On_Hold_Days__c number field by + 1 the current value. I will have a second workflow labelled WORKFLOW2 which triggers when On_Hold_Days__c > 0 and when the record is created/updated, this will do two field updates 1 Day after Triggered Date: one to my desired date field Completion_Date__c + 1 AND On_Hold_Days + 1. On the On_Hold_Days field update I assume I need tick "Re-evaluate Workflow Rules after Field Change". Is this correct? – Deployment Failure Feb 10 '15 at 13:01
  • Default value for On_Hold_Days would be 0. – Deployment Failure Feb 10 '15 at 13:13
  • Hmm I was thinking more along of the lines of adding another trigger to turn it off when stage changes, but I think setting WORKFLOW 2 to only run when On_Hold_Days__c < 30 might be better. – Deployment Failure Feb 10 '15 at 13:16
  • Indeed it'll be better with this condition. Just some changes on what you said : One of your workflow needs to update your Completion Date, while the second needs to set the new Last Triggered Date with current date, and increment On_Hold_Days +1. The second workflow will trigger every times On_Hold_Days is updated. And the first will trigger "1 day after Last Triggered Date" As you said, set On_Hold_Days default value to 0, and Last Triggered Date to today date – MMT Feb 10 '15 at 13:27
  • 1
    Because you want to update Completion Date every day during 30 days, so you need to know : 1-For how long the workflow is running (On_Hold_Days) ; 2-When it has been run for the last time (Last Triggered Date). If you only say "Ok, execute this field update 1 day after Last Triggered Date" but do not update it, it'll only execute once. That's why you need a second workflow, that update Last Triggered Date, and fire again the first (I forgot to say that one of conditions to fire this workflow is ISCHANGED(Last Triggered Date)) – MMT Feb 10 '15 at 14:32
1

Could you create some 'schedulable' apex (docs here) to do the increment and a cron job to run it every day?

  • Yes I am aware of cron job apex but my requirements are to use apex only when absolutely nessessary, I would like to use Salesforce applications to implement this. – Deployment Failure Feb 10 '15 at 11:11
0

You can achieve this by setting up 2 workflow rules that will update a custom date field which will mimic recurring workflows like this

Workflow Rule 1 : Update Custom Date field to Today (Immediate Action)

Workflow Rule 2 : Update Custom Date Field to Today (Time-triggered action one day after the first workflow rule). This date will also be a part of the the criteria in the second workflow rule.

The detailed explanation for the same can be found in the below link

Set up recurring time-based workflow rule

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.