0

I am new to Salesforce and recently learned I cannot schedule workflows to run on certain dates, but must manually (or programatically) edit the record to activate the workflow. After some research it looks like an Apex trigger would work better to accomplish this through scheduled Apex. I am not a programmer, and don't know how to accomplish this. Here is what I have so far....which isn't working...

trigger WorkflowTrigger on Policy_c (after update) { for (Policy_c obj: trigger.new) { WF_Apex_Trigger_Date__c = TODAY; } }

WF_Apex_Trigger_Date__c is a field on the Policy object that I want to update with the current date. The workflow is written to evaluate any time the record is edited, and attach a time-based task at 120, 60, and 30 days.

Can anyone point me in the right direction, or tell me what I'm doing wrong? Thanks...

3

You wouldn't be able to use trigger for this either. Just like workflows, triggers only fire when a record is inserted, edited, or deleted. If you have a job that you want to run on a scheduled basis that goes through records and updates them, then you should use scheduled apex.

| improve this answer | |
  • No problem. Please vote up and mark my answer as having answered your question. – Daniel Hoechst Jul 17 '13 at 20:59

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.