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
Todd KadasTodd Kadas 

create log a call list button with visualforce page (attempt to de-reference a null object

Hello kind people,

I'm sure this is rather simple but I've been struggling with it for a while.  I'm just trying to create a list button for a custom log a call feature that I can add to my Account Activity History.
Here is the class:
public class LogCallController2 
{

    public LogCallController2(ApexPages.StandardSetController controller) {

    }

    public task t1{get;set;}
    //public task t1{get
    //{
    //String strId = ApexPages.currentPage().getParameters().get('id');
    //t1=[SELECT Id, WhatId FROM Task WHERE id =:strId];
    //return t1;
    //}
    //set;}
    public LogCallController2(ApexPages.StandardController controller) 
    {
   
        t1= new task();
    }
    public PageReference save()
    {
        insert t1;
        //PageReference p=new PageReference('/a0T/o');
        //return p;
        return null;
    }
}
And here is the VF page.  Ideally,  I would like to be able to pre-populate all fields with the exception of Comments (Description) and Who Id. 

I tried to give up and just go the old URL hack route with a custom record type and page layout but it seems I coudn't pass values to text fields in LEX.  

Any assistance anyone can offer would be greatly appreciated.  
 
<apex:page standardController="Task" recordSetVar="tasks" extensions="LogCallController2">
  <apex:form >
  <apex:pageBlock title="Log a Call">
  <apex:pageBlockSection >
  <apex:inputField value="{!task.Subject}"/>
    <apex:inputField value="{!task.Description}"/>
      <apex:inputField value="{!task.ActivityDate}"/>
        <apex:inputField value="{!task.Priority}"/>
         <apex:inputField value="{!task.Status}"/>
          <apex:inputField value="{!task.WhatId}"/>
           <apex:inputField value="{!task.WhoId}"/>        
  </apex:pageBlockSection>
  <apex:pageBlockButtons location="top">
  <apex:commandButton value="Save" action="{!save}"/>
    <apex:commandButton value="Cancel" action="{!cancel}"/>
  </apex:pageBlockButtons>
  </apex:pageBlock>
  </apex:form>
</apex:page>