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
Glenn Nyhan 54Glenn Nyhan 54 

Formula Field for Check Box Result

I'm having some trouble with a formula. I want to populate a date field with the days date when the opt out check box is checked. Anybody have any suggestions? 

Here's what I tried which didn't work:

IF salesforce Opt_Out__c = "True" TODAY()
Best Answer chosen by Glenn Nyhan 54
Akhil AnilAkhil Anil
Hi Glenn,

A formula field will not help you with populating the date when the checkbox was actually checked. You will need a workflow rule or a process builder to do that. Simply follow the below steps.

Create a custom field of the type Date (NOT a formula field)

Create a workflow rule as below

Evaluation criteria : Everytime a record is created and edited to subsequently meet the criteria (3rd Option)

Workflow entry Criteria

Optout checkbox = TRUE

Now select the date field you had created in Workflow field Update and your formula for the same would be simply below
 
TODAY()

Activate your workflow rule and you should be good to go !

All Answers

UC InnovationUC Innovation
Hi Glenn,

Since the date you wish to record is the date in which the box was checked or the value becomes true, then a formula field would be a solution to your problem since formulas are based on values and not events. What you are looking for is, and what i recommend, is using process builder (https://trailhead.salesforce.com/en/business_process_automation/process_builder) which will run when the record is updated or created. It should then record the date of the change via a record update. Read up on those through the link provided. Any further questions welcome.

Hope this helps!

AM
Akhil AnilAkhil Anil
Hi Glenn,

A formula field will not help you with populating the date when the checkbox was actually checked. You will need a workflow rule or a process builder to do that. Simply follow the below steps.

Create a custom field of the type Date (NOT a formula field)

Create a workflow rule as below

Evaluation criteria : Everytime a record is created and edited to subsequently meet the criteria (3rd Option)

Workflow entry Criteria

Optout checkbox = TRUE

Now select the date field you had created in Workflow field Update and your formula for the same would be simply below
 
TODAY()

Activate your workflow rule and you should be good to go !
This was selected as the best answer
Glenn Nyhan 54Glenn Nyhan 54
Thanks for both suggestions. Both would work. I used the Workflow Rule approach and was able to post the date. Thanks again for the help, much appreciated.
LetteLette
How can I do if I want to have date and time when the opt out check box is checked? TODAY() doesn't work (Formula result is data type (Date), incompatible with expected data type (Date/Time)?