I am getting the following error message from my VF page and controller extension. Does anyone know how to resolve?

apex:inputField can only be used with SObjects, or objects that are Visualforce field component resolvable.

VF Page:

<apex:page standardController="Contact" tabStyle="Contact" sidebar="false" extensions="RDATasks" action="{!RDA}">

<apex:form >

<apex:sectionHeader title="Revenue Driving Activities"/>

<apex:outputPanel id="taskList">
<apex:repeat value="{!listTask}" var="tsk">
    <apex:pageBlock >
        <apex:pageBlockSection title="Main RDA">
            <apex:outputField value="{!Contact.Account.Name}" label="Related To"/>
            <apex:outputField value="{!Contact.Name}" label="Name"/>
            <apex:inputField value="{!tsk.Type_of_RDA__c}" style="width:35%"/>
            <apex:inputField value="{!tsk.Subject}" style="width:45%"/>
            <apex:inputField value="{!tsk.Type_Detail__c}" style="width:35%"/>
            <apex:inputField value="{!tsk.ActivityDate}" style="width:35%"/>
            <apex:inputField value="{!tsk.Status}" />
            <apex:inputField value="{!tsk.Description}" style="width:100%"/>
            <apex:inputField value="{!tsk.FollowUp__c}" style="width:100%">
                <apex:actionSupport event="onchange" rerender="taskList,followTask"/>

<apex:outputPanel id="followtask">
<apex:variable var="tskF" value="{!listTaskFollow}"/>
        <apex:pageBlockSection title="Follow-Up RDA" rendered="{!tsk.FollowUp__c}">
            <apex:outputField value="{!Contact.Account.Name}" label="Related To"/>
            <apex:outputField value="{!Contact.Name}" label="Name"/>
            <apex:inputField value="{!tskF.Type_of_RDA__c}" style="width:35%"/>
            <apex:inputField value="{!tskF.Subject}" style="width:45%"/>
            <apex:inputField value="{!tskF.Type_Detail__c}" style="width:35%"/>
            <apex:inputField value="{!tskF.ActivityDate}" style="width:35%"/>
            <apex:inputField value="{!tskF.Status}" />
            <apex:inputField value="{!tskF.Description}" style="width:100%"/>



    <apex:commandButton value="Add Another RDA" action="{!RDA}"/>
    <apex:commandButton value="Remove Last RDA" action="{!removeRDA}"/>
    <apex:commandButton value="Save RDAs" action="{!saveTask}"/>



public with sharing class RDATasks{

    public list<Task> listTask{get;set;}
    public list<Task> listTaskFollow{get;set;}
    public integer n;

    Set<Task>Tasks = new Set<Task>();
    Set<Task>FollowTasks = new Set<Task>();

    private final Contact con;
    public RDATasks(ApexPages.StandardController myController){
        listTask = new List<Task>();
        listTaskFollow = new List<Task>();

//  Adds RDA Task to list
    public void RDA()
        listTask.add(new Task(
           WhoId = con.Id,
           Status = 'Completed',
           ActivityDate = system.TODAY(),
           Subject = '',
           Description = '',
           OwnerId = UserInfo.getUserId(),
           WhatId = con.AccountId,
           RDA__c = TRUE,
           FollowUp__c = FALSE)

//  Adds RDA Follow-Up Task to list
    public void RDAfollow()
        n=listTask.size() - 1;
        listTask[n].FollowUp__c = FALSE;
        listTaskFollow.add(new Task(
           WhoId = con.Id,
           Status = 'In Progress',
           ActivityDate = system.TODAY()+7,
           Subject = 'Follow-Up: '+listTask[n].Subject,
           OwnerId = UserInfo.getUserId(),
           WhatId = con.AccountId,
           RDA__c = TRUE,
           FollowUp__c = TRUE)

//  Saves list of RDA Tasks added
    public PageReference saveTask(){
        insert listTask;
        insert listTaskFollow;

            integer last = listTaskFollow.size();
            PageReference contactPage = new PageReference('/' + con.Id);
            return contactPage;

3 Answers 3


Since apex:inputField can only be used with SObjects, or objects that are Visualforce field component resolvable.

So, probably this line onward you will receive the error.

Change <apex:inputField value="{!tsk.Type_of_RDA__c}" style="width:35%"/> to <apex:inputText value="{!tsk.Type_of_RDA__c}" style="width:35%"/>

And any <apex:outputField/> to <apex:outputText/>

You can try to explore the <apex:column> in this situation.

  • Thanks. One problem is those fields are picklists. Is there a way to keep that functionality? Jan 24, 2017 at 22:00
  • do not use picklist as inputField Jan 24, 2017 at 22:02
  • can you please close this question, if you are happy with the answer Jan 25, 2017 at 19:37

you need to change the tag to inputtext.


It's quite likely that this is the culprit here:

<apex:variable var="tskF" value="{!listTaskFollow}"/>

You are then using the tskF variable in your code as though it is a Task object, when in reality it is a List<Task>, and an empty one at that. You will need to come up with a way of passing in a Task object from your controller to be used here instead.

As an aside, I would look at how you are populating the first value for listTask - currently, you are doing so by calling the RDA() method in the action attribute of the apex:page tag.

The documentation for the apex:page tag contains the following warning for the action attribute:

Important: This action should not be used for initialization or DML.

A better location for this call is in the constructor of your controller, as this is guaranteed to be called first on each page load. For more information see Order of Execution for Visualforce Page Get Requests

  • Does anybody know why page actions are recommended to not be used for initialization or DML? It's a common requirement to do a DML op on page load, and that's the workaround I've been using for years!
    – jkraybill
    Jan 25, 2017 at 3:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .