You need to sign in to do that
Don't have an account?
sp08830
Create task from VF
Task gets created without a subject from this VF page. I think there some simple mistake but am unable to figure out. Can someone help me.
public class test1 { public task newtask {get; set;} Public pagereference createTask() { NewTask= new Task(ownerid = userinfo.getUserId(),activitydate = Date.today(), Status ='Open', Priority = 'Normal',whatId = 'record id' ); insert newTask; return new Pagereference('/apex/test1'); } }
<apex:page controller="test1" > <apex:form > <apex:pageMessages /> <apex:outputLabel value="Enter Subject: "/> <apex:inputField value="{!NewTask.Subject}"/> <br/> <apex:commandButton value="Add" action="{!CreateTask}" /> </apex:form> </apex:page>
Hi,
By just looking at the piece of code you've provided, I understand that the createtask() is creating the task but is not initializing any value to the subjecy which looks like the reason the subject is not getting populated..