+ Start a Discussion
KatherineCKatherineC 

Time Based Trigger

Hi All,

I created an Object Pint for Payroll Integration, it will show account information and payroll date etc.. We want the Pint to be self generated 5 business days before the payroll date. Say for biweekly payroll. Is there a way to do that? What trigger shall I use? Any suggestion appreciate. 
Ravikant kediaRavikant kedia
you can read here 
  http://stackoverflow.com/questions/5573002/sql-2008-r2-time-based-triggers
KatherineCKatherineC
Thanks for the reply, but I want to use Apex code in the salesforce, do you know Apex scheduler and how to use for this situation?
Abhishek_PareekAbhishek_Pareek
You can create Time-Based Workflow on your object and add Time Trigger action in that workflow. Below are couple of links explaining the FAQ's related to Time-Based Workflow:
https://help.salesforce.com/HTViewSolution?id=000005245&language=en_US (https://help.salesforce.com/HTViewSolution?id=000005245&language=en_US)
https://help.salesforce.com/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en_US)
KatherineCKatherineC
Hi Abhishek,
Thanks for the reply, I noticed that actions available for a time-based workflow rule are email alerts, field updates, tasks and outbound messages only, can not generate a Pint like generate a case automatically on a regular basis. Any other thought? 
Avidev9Avidev9
Sounds Interesting!
What about mixing Workflow time triggers with Apex Trigger to create a record ?
You can use Time Triggers to invoke a trigger and use trigger to create your records ?

Few days back I have writter a similar post, you can check the same here http://blogforce9.blogspot.in/2013/05/synchronising-apex-triggers-with.html
KatherineCKatherineC
Hi Avidev9,

Thanks for the brilliant idea, I want to try it out but got error message for the trigger code, please help:

trigger invokeApexCloning on Pint__c (after update) { 
   for(Pint__c pint : trigger.New){ 
     if(pint.invokeApex__c != trigger.Old.get(pint.Id).invokeApex__c && pint.invokeApex__c == TRUE){ 
       //invoke your action here 
       CloningUtil.clone(pint); 
     } 
   } 
}

Error: Compile Error: Variable does not exist: CloningUtil at line 5 column 8

As a newbie for coding, I'm cracking my brain to learn batch apex, really hope this alternative will work. 

Thanks!!

KatherineCKatherineC
Also, what's "update_c" on first line, I got error message that don't recognize update__c, so I removed __c