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
RoeeaRoeea 

need help in setting up complex workflow rule

I need to automaticlly update a date field by using Workflow capabilities
We created a contract and need to have a date field with "conteract's future end date"
This field should be calculated as followed:
1. as long as the contract is active
2. in the contract we have fields:
"first contract's terms" = (X number of months)
"adittional contract's terms" = (Y number of months)
3 once a contract is acivated:
"conteract's future end date" sould be "activation date + "first contract's terms"
4. as long as the contract is active, every time the "contract's future end date" = TODAY. the system shoud add to this date the "adittional contract's terms"
Can someone helop me in setting this up?
Thanks
Roee

SoumoSoumo

Hi,

 

For your requirement 1,2 and 3 you can write a before update, before insert trigger and do with apex rather than workflow.

 

For requirement 4, you have to write a scheduled apex job which will run everyday to check the condition, "contract's future end date" = TODAY.

 

The reason for trigger instead of workflow is, field update in workflow cannot actually calculate the date based on monthly terms. You can find the response from salesforce.com product manager regarding this requirement in below link:

 

http://boards.developerforce.com/t5/Product-Discussion/Adding-Months-in-Custom-Fields/td-p/23092

 

Hope this helps.

 

Soumo

RoeeaRoeea

thanks for the reply

I'm not a developer so can you please explain a bit more on how to create APEX trigger

why not using a workflow rule? how do I create APEX trigger? 

Any deeper explaination would help

Best

Roee