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
sp13sp13 

automatically changing field value (workflow rule or trigger)

i have a custom picklist Status__c with values 'Open' & 'Closed' and a date field Close_Date__c.

what should i do if i want the Status__c to update its value to 'Closed' whenever the value of Close_Date__c is less than or equal to today's date[system.today()] without editing/updating the record?

if i use a trigger then the record's Status__c will only update whenever the record is created or edited. i tried using a workflow rule for this but it didn't work. the evaluation criteria of the workflow rule is 'created, and any time it’s edited to subsequently meet criteria'. 

Adnubis LLCAdnubis LLC
You will have to interact with the record in some way to make this work. You could schedule Apex to run daily and loop through your records looking for this criteria and updating as needed. Here are two pages that can give some details on how to do scheduled apex.

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_interface_system_schedulable.htm
Elie.RodrigueElie.Rodrigue
You can use a time based workflow rule.
When you are creating your wf rule, select : created, and any time its edited to subsequently meet criteria (this will make sure that the time trigger is reevaluation in case the close date is updateD)
Then select run this rule if the following : formula evaluates to true.
As a formula, just enter : true
Your workflow and rule apply to every instance of your object. You could also have it to run only for those where Close Date is not null and is in the future

In the next step, click add time trigger, you then add : 0 hours after "your object" "close date", and then you'll be able to add a field update action.