You need to sign in to do that
Don't have an account?

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.

Visualforce page
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); newTasks.add(tk); if(newTasks.size() >= 200){ insert newTasks; newTasks.clear(); } } if(!newTasks.isEmpty()){ 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:pageBlockButtons> <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> <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> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>