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
Bill DoyelBill Doyel 

Campaign Member Mass Task - Task Type Issue

Hello All,

I am attempting to use a slightly modified version of the Salesforce Labs App: "Campaign Member Mass Task Creator 1.1"
https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016waPEAQ

I have added in the "Task Type" field onto the page - which renders correctly as the task type drop down.  However, when the tasks are created - the type that I selected on the page - does not actually save with the activity.  Below is the apex code used for this.  Any suggestions on what is missing that I can do to get the type to save would be appreciated.

<apex:page tabstyle="Campaign_Member_Task__tab" title="Campaign Member Mass Task Creator" controller="CampaignMemberFollowUpController" >

<apex:form >
<apex:sectionHeader title="Mass Creation Of Tasks Concerning Campaign Members" >
<!-- <p align="center"><b><apex:outputtext id="message" value="Campaign ID: {!campaign}, showtask {!showtask},showCampaignSelection: {!showCampaignSelection}"/></b></p><br/> -->
<apex:outputPanel >
<apex:pageBlock title="For which campaign do you want to create task(s)?" rendered="{!showCampaignSelection}">
    <apex:pageBlockSection columns="3">      
       <apex:pageBlockSectionItem >
            <apex:outputLabel value="Filter by Status" for="CampaignStatus"/>
            <apex:selectList id="CampaignStatus" value="{!selectcampaignstatus}"  multiselect="false" size="1">
                <apex:selectOptions value="{!itemscampaignstatus}"/>
                <apex:actionSupport event="onchange" action="{!renderfollowupfalse}" rerender="CampaignList, FollowUp, CMresults, SelectButton, message"/>
            </apex:selectList>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Campaign" for="CampaignList"/>
            <apex:selectList id="CampaignList" value="{!campaign}"  multiselect="false" size="1">
                <apex:selectOptions value="{!campaigns}"/>
                <apex:actionSupport event="onchange" action="{!renderFollowUpFalse}" rerender="FollowUp, CMresults, message"/>
             </apex:selectList>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
             <apex:commandButton id="SelectButton" value="Select" action="{!renderfollowuptrue}" disabled="{!NOT(showSelectButton)}" rerender="pageMessage, FollowUp, CMresults, FollowUpButton, message"/>
        </apex:pageBlockSectionItem>       
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:outputPanel id="FollowUp">
<apex:pageBlock rendered="{!showtask}">
    <apex:pageBlockSection id="Task" title="Define your task(s)!" collapsible="false">
        <apex:pageBlockSectionItem helpText="If selected, a task for the lead or contact owner of the campaign member will be created.">
            <apex:outputLabel value="Use Member's Owner"/>
            <apex:inputCheckbox id="cMOcheckbox" value="{!CMOwner}">
            <apex:actionSupport event="onclick" rerender="Task"/>
            </apex:inputCheckbox>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Assigned To" for="assigendField" rendered="{!NOT(CMOwner)}"/>
            <apex:inputField value="{!ownertodo.ownerid}" id="assigendField" rendered="{!NOT(CMOwner)}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Status" for="StatusTask"/>
            <apex:inputField id="StatusTask" value="{!ownertodo.status}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Due Date" for="TaskDate"/>
            <apex:inputField value="{!ownertodo.activitydate}" id="TaskDate"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Campaign" for="relatedCampaign"/>
            <apex:outputField id="relatedCampaign" value="{!ownertodo.whatid}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
             <apex:outputLabel value="Reminder" for="isReminder"/>
            <apex:inputField id="isReminder" value="{!ownertodo.isReminderSet}">
            <apex:actionSupport event="onclick" rerender="Task"/>
            </apex:inputField>         
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
               <apex:outputLabel value="Reminder Date" for="ReminderDate" rendered="{!ownertodo.isReminderSet}"/>
            <apex:inputField id="ReminderDate" value="{!ownertodo.ReminderDateTime}" rendered="{!ownertodo.isReminderSet}"/>     
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Priority" for="Priority"/>
            <apex:inputField id="Priority" value="{!ownertodo.priority}"/>
        </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:pageBlockSection columns="1">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Type" for="Type"/>
            <apex:inputField id="Type" value="{!ownertodo.type}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Subject" for="Subject"/>
            <apex:inputField id="Subject" value="{!ownertodo.subject}" style="width:500px"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Description" for="description"/>
            <apex:inputField id="description" value="{!ownertodo.description}" style="width:500px"/>
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:outputPanel id="CMresults" >
<apex:pageBlock title="Select these campaign members for which do you want to create a task!" rendered="{!IF(CMemberList_size > 0, true, false)}">
<apex:actionStatus startText="Requesting..." id="SelectStatus"/>
<apex:outputText id="Number" value="{!SelectedCM} selected, displaying {!pagenext} to {!pageuntil} of {!CMemberList_size}"/>
    <apex:pageBlockButtons >
        <apex:commandButton id="FollowUpButton" value="Create Follow Up" action="{!generateTodos}" disabled="{!IF(selectedCM > 0, false, true)}"/>
        <apex:commandButton id="SelectMemberButton" value="(De)Select All Members" Status="SelectStatus" action="{!selectAllCMembers}" rerender="CMresults, FollowUpButton, selectMessage, pageMessage"/>
        <apex:commandButton value="Prev" action="{!Prev}" disabled="{!NOT(showprev)}" status="PagingStatus" rerender="CMresults, selectMessage"/>
        <apex:commandButton value="Next" action="{!Next}" disabled="{!NOT(shownext)}" status="PagingStatus" rerender="CMresults, selectMessage"/>
        <apex:actionStatus startText="Requesting..." id="PagingStatus"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="Campaign Members" columns="1" collapsible="false">
        <apex:pageBlockTable value="{!cmemberlistnext}" var="cml">
            <apex:column >
                <apex:facet name="header">
                <apex:inputCheckBox value="{!allCheckboxes}">
                <apex:actionSupport event="onclick" action="{!changecheckbox}" Status="SelectStatus" rerender="CMresults, FollowUpButton, pageMessage" />
                </apex:inputCheckBox>
                </apex:facet>
                <apex:inputCheckbox value="{!cml.checkedMember}" id="selectLine">
                <apex:actionSupport event="onclick" action="{!changeSingleCheckbox}" Status="SelectStatus" rerender="FollowUpButton, CMresults, pageMessage" />
                </apex:inputCheckbox>
            </apex:column>
            <apex:column value="{!cml.CMType}"> 
                <apex:facet name="header">Type</apex:facet>
            </apex:column>
            <apex:column value="{!cml.Title}">
                <apex:facet name="header">Title</apex:facet>
            </apex:column>                             
            <apex:column value="{!cml.FirstName} {!cml.LastName}">  
                <apex:facet name="header">Name</apex:facet>
            </apex:column>
            <apex:column value="{!cml.Email}">
                <apex:facet name="header">E-Mail</apex:facet>
            </apex:column>  
            <apex:column value="{!cml.Employer}">
                <apex:facet name="header">Company</apex:facet>
            </apex:column>
            <apex:column value="{!cml.Status}">
                 <apex:facet name="header">Status</apex:facet>
            </apex:column>                                                     
        </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:sectionHeader>      
</apex:form>

<!-- This section is used in order to init the date picker correct. This is a known issues. -->
<div Style="Display: none">
<apex:form >
<apex:inputField value="{!ownertodo.activitydate}" id="test"/>
</apex:form>
</div>
</apex:page>
Ashish_SFDCAshish_SFDC
Hi Bill,


What is the Field name for Task Type and how are you referencing the Binding for the Field on the Visualforce page to the Field in the SObject.

See this as an example for field binding. 

http://stackoverflow.com/questions/1942372/inputfield-databinding-issue-with-visualforce


Regards,
Ashish