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
pooja biswaspooja biswas 

formula field trigger workflow

I have a Boolean formula field which is turn to true while records created date more than 3 days.
f this formula field turn to true then a workflow will trigger to change a lookup field (User) value, this workflow rule Evaluation Criteria I set as (created, and any time it's edited to subsequently meet criteria)

But when the formula field turn to true but lookup value still remains the same (it doesnt change)

Is this possible in salesforce?

Pooja

 
Best Answer chosen by pooja biswas
Amit Singh 1Amit Singh 1
Hi Pooja,

In Salesforce, when formula fields turn to true(OR changes) then it will not update the record in other words no DML is being performed on the record. That is why Lookup field remains same.
 
The workaround to this problem is, you can write an Apex Batch which will take those records as input which has created date more than 3 days and then checks if formula field is true then update Lookup field otherwise, do not change.
 
You can schedule your batch to execute at every 5 minutes or every day at night.
 
Let me know if this makes sense.
 
Thanks,
Amit Singh.

All Answers

Amit Singh 1Amit Singh 1
Hi Pooja,

In Salesforce, when formula fields turn to true(OR changes) then it will not update the record in other words no DML is being performed on the record. That is why Lookup field remains same.
 
The workaround to this problem is, you can write an Apex Batch which will take those records as input which has created date more than 3 days and then checks if formula field is true then update Lookup field otherwise, do not change.
 
You can schedule your batch to execute at every 5 minutes or every day at night.
 
Let me know if this makes sense.
 
Thanks,
Amit Singh.
This was selected as the best answer
pooja biswaspooja biswas
Hi amit
so this means formula fields cannot be used ad field updates in an workflow. am I right?

Pooja
 
Amit Singh 1Amit Singh 1
Hi Pooja,

Yes, you are right. For this, you can use apex batch as I mentioned earlier.

Thanks,
Amit.
PipDennoPipDenno
If you a looking for a solution that will work without code you could have two workflows do this for you if I'm understanding what you are trying to do. 

1st Have a time based workflow update a field in 3 days (either an existing or a new field like 'over 3 days'.  2nd If you then need something else to happen on the > 3 days you can create a workflow that runs when the first field is updated which will be after 3 days rule has run.  Hope this also helps.

Phil.