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
rajesh k 10rajesh k 10 

How to schedule my batch class based on frequency Dynamically?

Hi,
           I have one frequency picklist field.I this picklist field values are Weekly,Monthly by day,Monthly by date and custom.When i select Weekly picklist value page rendered as Sunday,Monday.......Saturday checkboxes will be displayed.When i select Monthly by day picklist value page rendered as two picklists one is 1st,2nd,3rd,4th and last ,second picklist as Sunday,Monday.......Saturday  will be displayed.When i select Monthly by date picklist value page rendered as picklist as  1st,2nd,3rd,4th........31st and  last   will be displayed.When i select Custom value in picklist page rendered as  DayOfMonth(Textbox),Month:(Textbox),DayOfWeek:(Textbox),Year:(Textbox) .I gave Job name ,Startdate,Enddate and PreferredStartTime field as Hours(12AM,1AM....11PM),Minuts(00,01,02....59) and seconds(00,01,02....59).

NOTE:UI I designed how to perform backend operation based on my UI.

How to add Frequency as CRON Expresson Dynamically From visualforce page?

please help me..............

logontokartiklogontokartik
Cron Expressions are nothing but a String values when you are trying to schedule something, so if you already have the UI built in, all you have to do is to build the Cron as string and use that string to schedule Apex. More info on the various crons and apex scheduler can be found in below link

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
rajesh k 10rajesh k 10
Hi ,
          Is it possible Frequency schedule dynamically from my UI.Please help me Frequency picklist how to apply dynamically.I designed that UI.You want to code means give me your mail id i will farword.From 2 weeks to i try to this task.

please help me...........
Bindhyachal Kumar SinghBindhyachal Kumar Singh
Hi Rajesh,

You can use frequency picklist and its cron expression to schedule an apex batch class dunamically.
rajesh k 10rajesh k 10
Hi,
              How ?I want to this only

please help me........

Bindhyachal Kumar SinghBindhyachal Kumar Singh
Hi Rajesh,

For 1st of every month:

0 0 12 1 1/1 ? * 

You need to give 1,2,3,4,and 28,29 (Feb),30,31 dynamically based on months

0 0 12 2 1/1 ? *                        (Just change from 1 to 2 for 2nd of every month at 12:00 )


rajesh k 10rajesh k 10
Hi,
         Give me your mail id i will farword my code........
Faiza Naz 10Faiza Naz 10
May be its too late to answer your question now. but you can get help from below link.
http://faizanaz90.blogspot.com/2016/03/apex-creating-cron-expression.html