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
Allister McKenzie 10Allister McKenzie 10 

Error: Value 'new test' cannot be converted from Text to core.apexpages.el.adapters.metadata.VFSObjectELAdapter

I'm receiving an error on my visualforce page when I try save records.  It is happening on the subject field for Tasks.  When I checked the Task subject field, it is defined as a picklist, but even when I choose one of the predefined picklist values, I still receive an error.

Task Subject Error
public with sharing class AddTasksToCases {

    public Case[] caseList = null;
    public Task cftTask {get; set;}
    public AddTasksToCases(ApexPages.StandardSetController setCon) {       
        caseList = setCon.getSelected();
        //newTask = new Task();        

    public pageReference CreateTask(){
        Task[] newTasks = new Task[]{};
        for(Case c : caseList){
             Task tk = new Task(
             	 WhatId = c.Id, 
             	 OwnerId = cftTask.Owner.Id, 
             	 Subject = cftTask.Subject, 
             	 Role__c = cftTask.Role__c, 
                 ActivityDate = cftTask.ActivityDate,
                 Description = cftTask.Description,
                 Status = cftTask.Status,
                 Type = cftTask.Type);
            if(newTasks.size() >= 200){
                insert newTasks;
            insert newTasks;
        return new PageReference('/500');

Visualforce page
<apex:page showHeader="true" sidebar="true" standardController="Case" recordSetVar="cases" extensions="AddTasksToCases">
    <apex:sectionHeader title="Cases" subtitle="Mass Task Create" />
    <apex:form >
        <apex:pageBlock title="CFT Task">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Add Tasks" action="{!CreateTask}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
           <apex:pageBlockSection columns="2" title="Assignee Information">
               <apex:inputField value="{!cftTask.OwnerId}"></apex:inputField>
               <apex:inputField value="{!cftTask.Role__c}"></apex:inputField>
               <apex:inputField value="{!cftTask.Type}"></apex:inputField>
               <apex:inputField value="{!cftTask.ActivityDate}"></apex:inputField>
           <apex:pageBlockSection columns="1" title="Task Description">
               <apex:inputField value="{!cftTask.Status}"></apex:inputField>
               <apex:inputField value="{!cftTask.Subject}"></apex:inputField>
               <apex:inputField value="{!cftTask.Description}"></apex:inputField>