0

I have a formula check box whose value changes based on a date field (whether date is lesser than TODAY()). Now i want to update a text field based on whether the check box is true or not. i created a workflow rule for this. it is working fine only when i manually change the date which then alters the check box and then the text is set . but the problem arises when i let the date expire , the formula check box value changes but the text field is not changed. it still holds the old value.

i was thinking of creating a formula text field and do some thing like a java if

if (check box == true)
{
text field = null;
}

but the i couldn't do it. It said the IF here only accepts true or false

Any inputs would be appreciated. ps. i know i have a check box as an added unnecessary layer when it should have been just based on the date field alone.

0

Couldn't you use "IF" for the formula?

IF(insert formula that needs to evaluate to true, value_if_true, value_if_false)

You can insert other functions within the IF statement if you need to.

0

At this time, formula fields cannot cause workflow to run. There is an idea on the Idea Exchange to allow this, and it is under consideration, but I completely believe the comment by product management that says this is not an easy feature to bring.

Your formula for the text formula field looks generally correct, and should work if you fix one issue. In formula fields, and a few other spots like workflow evaluation formulae, the equality check is single equals =, rather than the double equals == used in Apex.

+edit:

I completely glossed over the fact that the IF function available in formulas is of the form IF(condition, then do this, else do this).

Change the == to =, and your formula field should work.

  • 3
    == and = are both equally acceptable in a formula, actually. – sfdcfox Jan 22 '16 at 18:50
  • Could've sworn that would've resulted in an error. I learned something today. – Derek F Jan 22 '16 at 19:26
0

You need a Time-Based Workflow Rule. Set the criteria for the rule to be "checkbox = true", and triggered on create or when the record meets the criteria. Then, add a time based workflow action that has a fire date of your date field, with two workflow actions; one to uncheck the box and the other to clear the text field. You will need to "touch" each record once after activating the rule to make sure that all of your automatic updates will occur in a timely manner (e.g. the system will know to uncheck the box and clear the field when your date comes around). For more information, consider reading this help topic, Knowledge Article 5245.

  • thanks for the help. i will take a look at it. is there a way where you can have IF with just one parameter in salesforce like you can have in java – Dino Jan 22 '16 at 19:27
  • 1
    @Dino You shouldn't need an IF statement at all. One thing that many people don't realize is that a checkbox is a Boolean value. That means that you don't need an IF at all. – sfdcfox Jan 22 '16 at 19:44
  • Thanks for the help. i was dumb enough to create a workflow rule based on a formula field. i learnt it the hard way that you cannot. i ended up creating new formula field using if formula and populated it based on the existing values. – Dino Jan 26 '16 at 15:13

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.