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
DafuelDafuel 

How to acheive Recurring Task functionality On Overrired Task Vf Page

I have overrided the Task standard page with VF custom page and now what i want is to have "Create Recurrence Task" Functionality on Vf Page but i have no idea how to achieve this..

although i have created the Vf page that looks somewhat similar to original "Create RecurrenceTask" Section but what shuld i do in apex to create a series of tasks n shud i use javascript to calculate the frequency of tasks or any other way..

if anyone having ny solution plz hlp..

 

TwanTwan

the recurring parameters are described in this doc : http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_task.htm

 

do not forget to watch the end part Usage : Recurring Tasks

DafuelDafuel

hey..

i have already gone thru this link..but didn't find any solution...

is there any custom way to create a series of task...nd how wud i go implement its functionality in apex...

and do u think its possible by using the fields define in task object, i can implement the complete recurrence functionality in my vf..??  ...

TwanTwan

A series of task for me, is just a task created with flag IsRecurrence flied at true and the Recurrence prefixed fields with specific values.

So just create the form input for frequency/start date/end date ... and bind them with  your apexcontroller to Task fields.

What is the specific blocking point for your implementation ?

DafuelDafuel

Hey Thanks for replying...

see the only blocking point during implementation is how to bind the frequency  form fields to task standard fields mainly recurrence type and any properties associated with the given recurrence type....

for designing  vf i have used input types="radio" everywhere... for all frequncy fields but now how do i bind it to standard field like (recurrence type) and  set their properties eg RecurrenceDayOfWeekMask.. u can see my vf code...tell me

 Note: in short i just want to populate associated frequency fields so i can save the record n able to create a series..

<!-- ******************** -->
<apex:pageBlockSection title="Recurrence">
<apex:actionRegion >
<div class="pbSubsection">
    <table class="detailList" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr class="detailRow">
            <td colspan="4">
        <div>
        <input id="IsRecurrence" name="IsRecurrence" onclick="ManageDiv();" type="checkbox" value="{!task.IsRecurrence}"/>
        <label for="IsRecurrence">Create Recurring Series of Tasks</label>
        <div class="hiddenWarning" id="DisabledRecurrenceMsgDiv" style="visibility: hidden;">(You can't create a recurring task series with a group task.)</div></div></td>
    </tr>
    
    <tr class="detailRow last">
      <td colspan="3">
        <div id="recpat" style="display:none;">
            <table width="100%">
                <tbody><tr>
                    <td class="labelCol">
                        <label>Frequency</label>
                    </td>
                    <td>
                        <table class="recurrenceTable">
                            <tbody><tr><td>
                            <div>
                                <div>
                                    <input checked="checked" id="rectypeftd" name="rectype" onClick="radiobut();" type="radio" value="{!task.RECURRENCETYPE}"/>
                                    <label for="rectypeftd">Daily</label></div>
                                <div>
                                    <input id="rectypeftw" name="rectype" onClick="radiobut();" type="radio" value="{!task.RECURRENCETYPE}"/>
                                    <label for="rectypeftw">Weekly</label>
                                </div>
                                <div>
                                    <input id="rectypeftm" name="rectype" onClick="radiobut();" type="radio" value="{!task.RECURRENCETYPE}"/>
                                    <label for="rectypeftm">Monthly</label>
                                </div>
                                <div>
                                    <input id="rectypefty" name="rectype" onClick="radiobut();" type="radio" value="{!task.RECURRENCETYPE}"/>
                                    <label for="rectypefty">Yearly</label>
                                </div>
                           </div>
                    </td>  
                                <!-- For Period -->
                        <td>
                             <div class="periodElementGroup" id="d" >
                                    <div>
                                            <input checked="checked" id="recdd0" name="recd" title="Recurs every weekday" type="radio" value="d0"/>
                                            <label for="recdd0">Every weekday</label>
                                        </div>
                                        <div>
                                            <input id="recdd1" name="recd" title="Specify interval in days" type="radio" value="d1"/>
                                            <label for="recdd1"></label>Every <input id="di" name="di" onkeypress="document.getElementById('recdd1').checked=true;" size="3" title="specify interval in days" type="text" value="1"/> day(s)
                                        </div>
                                    </div>
                                
                                <div class="periodElementGroup" id="w" style="display: none;" >
                                    <div>Recurs every <input id="wi" name="wi" size="3" title="specify interval in weeks" type="text" value="1"/> week(s) on</div><div><input id="1" name="1" type="checkbox" value="1"/>
                                        <label for="1">Sunday</label><input id="2" name="2" type="checkbox" value="1"/>
                                        <label for="2">Monday</label><input id="4" name="4" type="checkbox" value="1"/>
                                        <label for="4">Tuesday</label><input id="8" name="8" type="checkbox" value="1"/>
                                        <label for="8">Wednesday</label><input id="16" name="16" type="checkbox" value="1"/>
                                        <label for="16">Thursday</label><input id="32" name="32" type="checkbox" value="1"/>
                                        <label for="32">Friday</label><input id="64" name="64" type="checkbox" value="1"/>
                                        <label for="64">Saturday</label></div></div>
                                            
                                <div class="periodElementGroup" id="m" style="display: none;">
                                    <div><input checked="checked" id="recmm0" name="recm" title="Specify number of days into month and monthly interval" type="radio" value="m0"/>
                                        <label for="recmm0"></label>On day <select id="mdom" name="mdom" onchange="document.getElementById('recmm0').checked=true;" title="select day of the month">                                              
                                                    <option value="1" selected="selected">1</option>
                                                    <option value="2">2</option>
                                                    <option value="3">3</option>
                                                    <option value="4">4</option>
                                                    <option value="5">5</option>
                                                    <option value="6">6</option>
                                                    <option value="7">7</option>
                                                    <option value="8">8</option>
                                                    <option value="9">9</option>
                                                    <option value="10">10</option>
                                                    <option value="11">11</option>
                                                    <option value="12">12</option>
                                                    <option value="13">13</option>
                                                    <option value="14">14</option>
                                                    <option value="15">15</option>
                                                    <option value="16">16</option>
                                                    <option value="17">17</option>
                                                    <option value="18">18</option>
                                                    <option value="19">19</option>
                                                    <option value="20">20</option>
                                                    <option value="21">21</option>
                                                    <option value="22">22</option>
                                                    <option value="23">23</option>...
                                                   
    </select> of every <input id="mint" name="mint" onkeypress="document.getElementById('recmm0').checked=true;" size="3" title="specify interval in months" type="text" value="1"/> month(s)</div>
    
    <div>
    <input id="recmm1" name="recm" title="Specify which day of which week and the monthly interval" type="radio" value="m1"/><label for="recmm1"></label>On the <select id="mnins" name="mnins" onchange="document.getElementById('recmm1').checked=true;" title="select which week of the month">
        <option value="1" selected="selected">1st</option>
        <option value="2">2nd</option>
        <option value="3">3rd</option>
        <option value="4">4th</option>
        <option value="5">last</option>
        </select>
            <select id="mndow" name="mndow" onchange="document.getElementById('recmm1').checked=true;" title="select which day of the week">
                <option value="127" selected="selected">day</option>
                <option value="1">Sunday</option>
                <option value="2">Monday</option>
                <option value="4">Tuesday</option>
                <option value="8">Wednesday</option>
                <option value="16">Thursday</option>
                <option value="32">Friday</option>
                <option value="64">Saturday</option>
            </select> of every <input id="mnint" name="mnint" onkeypress="document.getElementById('recmm1').checked=true;" size="3" title="specify interval in months" type="text" value="1" /> month(s)</div>
    </div>
                        <div id="y" style="display: none;">
                            <div><input checked="checked" id="recyy0" name="recy" title="Specify month and day" type="radio" value="y0"/><label for="recyy0"></label>On every <select id="ymoy" name="ymoy" onchange="document.getElementById('recyy0').checked=true;" title="select the month">
                            <option value="0">January</option>
                            <option value="1">February</option>
                            <option value="2">March</option>
                            <option value="3">April</option>
                            <option value="4">May</option>
                            <option value="5">June</option>
                            <option value="6">July</option>
                            <option value="7">August</option>
                            <option value="8" selected="selected">September</option>
                            <option value="9">October</option>
                            <option value="10">November</option>
                            <option value="11">December</option>
                            </select> <select id="ydom" name="ydom" onchange="document.getElementById('recyy0').checked=true;" title="select day of the month"><option value="1" selected="selected">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                            <option value="21">21</option>
                            <option value="22">22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                            <option value="25">25</option>
                            <option value="26">26</option>
                            <option value="27">27</option>
                            <option value="28">28</option>
                            <option value="29">29</option>
                            <option value="30">30</option>
                            <option value="31">31</option>
    </select></div><div><input id="recyy1" name="recy" title="Specify day of particular week in a specific month" type="radio" value="y1"/><label for="recyy1"></label>On the <select id="ynins" name="ynins" onchange="document.getElementById('recyy1').checked=true;" title="select which week of the month">
        <option value="1" selected="selected">1st</option>
        <option value="2">2nd</option>
        <option value="3">3rd</option>
        <option value="4">4th</option>
        <option value="5">last</option>
            </select>
        <select id="yndow" name="yndow" onchange="document.getElementById('recyy1').checked=true;" title="select which day of the week"><option value="127" selected="selected">day</option>
            <option value="1">Sunday</option>
            <option value="2">Monday</option>
            <option value="4">Tuesday</option>
            <option value="8">Wednesday</option>
            <option value="16">Thursday</option>
            <option value="32">Friday</option>
            <option value="64">Saturday</option>
</select> of <select id="ynmoy" name="ynmoy" onchange="document.getElementById('recyy1').checked=true;" title="select the month">
        <option value="0">January</option>
        <option value="1">February</option>
        <option value="2">March</option>
        <option value="3">April</option>
        <option value="4">May</option>
        <option value="5">June</option>
        <option value="6">July</option>
        <option value="7">August</option>
        <option value="8" selected="selected">September</option>
        <option value="9">October</option>
        <option value="10">November</option>
        <option value="11">December</option>
            </select>
        </div>
    </div>
</td></tr></tbody>
    </table>
</td></tr>

       <tr>
           <td class="labelCol requiredInput">
            <label for="RecurrenceStartDateOnly">Start Date</label>
        </td>
        <td class="data2Col col02">
            <div class="requiredInput">
                <div class="requiredBlock"></div>
                <span class="dateInput dateOnlyInput"><input id="RecurrenceStartDateOnly" name="RecurrenceStartDateOnly"  onfocus="DatePicker.pickDate(true, 'RecurrenceStartDateOnly', false);" size="12" type="text" value="{!task.RecurrenceStartDateOnly}"/>
                <span class="dateFormat">[&nbsp;<a href="javascript&colon;DatePicker.insertDate('9/23/2013', 'RecurrenceStartDateOnly', true);">9/23/2013</a>&nbsp;]</span></span>
                </div>
             </td>
         </tr>
         
      <tr>
        <td class="labelCol requiredInput">
            <label for="RecurrenceEndDateOnly">End Date</label>
        </td>
        <td class="data2Col col02">
            <div class="requiredInput">
                <div class="requiredBlock"></div>
                    <span class="dateInput dateOnlyInput">
                        <input id="RecurrenceEndDateOnly" name="RecurrenceEndDateOnly" onfocus="DatePicker.pickDate(false, 'RecurrenceEndDateOnly', false);" size="12" type="text" value="{!task.RecurrenceEndDateOnly}"/>
                           <span id="maxRecurrence">
                             <span class="dateFormat">[&nbsp;<a href="javascript&colon;DatePicker.insertDate('9/23/2013', 'RecurrenceEndDateOnly', true);">Calculate max end date</a>&nbsp;]</span>&nbsp;
                                 <div class="mouseOverInfoOuter" onfocus="addMouseOver(this)" onmouseover="addMouseOver(this)" tabindex="0"><img src="/s.gif" alt="" class="infoIcon" title=""/>
                                     <div class="mouseOverInfo" style="display: none; left: 20px; opacity: -0.19999999999999996;">You must specify an end date for recurring tasks. Click the link to calculate the maximum end date allowed based on the frequency you selected and to set the end date to this maximum.
                                     </div>
                                 </div>
                             </span>
                           </span>
            </div>
          </td>
     </tr>
</tbody>
</table></div></td></tr></tbody></table>
</div>
</apex:actionRegion>
</apex:pageBlockSection>
<script>
<!-- setting RecurrenceType field
document.getElementById("rectypeftd").value="RecursDaily";
 document.getElementById("rectypeftw").value="RecursWeekly";
 document.getElementById("rectypeftm").value="RecursMonthlyvalue";
 document.getElementById("rectypefty").value="RecursYearly";
 function radiobut(){
    if(document.getElementById('rectypeftd').checked==true){
    document.getElementById('d').style.display='block';
    document.getElementById('w').style.display='none';
    document.getElementById('m').style.display='none'
    document.getElementById('y').style.display='none'
    }
    else if(document.getElementById('rectypeftw').checked==true){
      document.getElementById('d').style.display='none';
    document.getElementById('w').style.display='block';
    document.getElementById('m').style.display='none'
    document.getElementById('y').style.display='none'
    }
    else if(document.getElementById('rectypeftm').checked){
      document.getElementById('d').style.display='none';
    document.getElementById('w').style.display='none';
    document.getElementById('m').style.display='block'
    document.getElementById('y').style.display='none'
    }
    else if (document.getElementById('rectypefty').checked){
    document.getElementById('d').style.display='none';
    document.getElementById('w').style.display='none';
    document.getElementById('m').style.display='none'
    document.getElementById('y').style.display='block'
    }}
function ManageDiv(){
if(document.getElementById('IsRecurrence').checked){
    document.getElementById('recpat').style.display='block';}
else{
document.getElementById('recpat').style.display='none';}
    }
</script>

 

TwanTwan

The global idea is :

 

Use apex form components like

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectRadio.htm

then bind them to public fields un your apex controller,

and in your controller method compute the "standard" fields of the task using the fields binded of the form

 

 

DafuelDafuel
Thanks Buddy.. for ur help..
i wud try this..
ThejasviThejasvi
Hi Dafuel,

Please let me know if you could get the task recurrence created. If yes, could you please let me know how did you acheive this. please advise me.

Thanks