• Angela Schloeder
  • NEWBIE
  • 50 Points
  • Member since 2014
  • Sr Salesforce Administrator/Sales Support Manager
  • C-Level Partners

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 35
    Replies
How can I get code coverage for this trigger?

trigger Countevent on event(after insert, after update) {
    
    public List<event> ltask1 = new List<event>();
    public id userids;
    public integer inp=0;   
    public integer inr=0;
    for(event t:Trigger.New){
        userids = t.ownerid;
      
        
    }
    ltask1 = [select id,Request_for_Meeting_Bonus__c from event where ownerid=:userids];

    
    
    for(event t:ltask1){
        if(t.Request_for_Meeting_Bonus__c==true){
            inp = inp+1;
        } else{
            inr = inr +1;
        }                
    }
    List<user> uopp = new List<user>(); 
    List<user> userop = [select id from user where id = :userids];

    for(user u: userop){
        u.Total_Requested__c = inp;
    
        uopp.add(u);  
    }
    if(uopp.size()>0){
        update uopp;
    }        
 
}
I'm trying to create a trigger to create a task everytime the field 'Call Results' is changed. This is what I have, but doesn't work. I am not a developer by any means. Copied this from another trigger and trying to make it work.

trigger NewCreateTask on Contact (after insert, after update) {
    List<Task> listOfTaskToBeInserted = new List<Task>();
    Task newtask;
    
    if(trigger.isInsert){
        for(Contact con : trigger.new){
            if(con.Call_Result__c == 'N/A' || con.Call_Result__c == 'Requested More Info' || con.Call_Result__c == 'Left voicemail' || con.Call_Result__c == 'No Answer or VM' || con.Call_Result__c == 'Not Interested' || con.Call_Result__c == 'Wants Call Back' || con.Call_Result__c == 'Set Meeting'){
                newtask = new Task();
                newtask.WhatId = con.AccountId;
                newtask.Subject = 'Task';
                newtask.whoId = con.id;
                newtask.ActivityDate = system.today();
                newTask.Status = 'Completed';
                {
                 listOfTaskToBeInserted.add(newTask);
               }
             }
          }
       }
      if(listOfTaskToBeInserted.size() > 0){
     upsert listOfTaskToBeInserted;  
  }
}
 
We have a trigger that doen't allow users to delete an Event, but admins that can delete events do not get the popup to confirm they do want to delete. How can I get the popup again?

trigger EventDelete on Event (before delete) {
    if([SELECT PermissionsModifyAllData FROM Profile WHERE Id = :UserInfo.getProfileId()].PermissionsModifyAllData) {
        return;
    }
    for (Event sb : Trigger.old) {
        sb.addError('Cannot delete an Event');
    }
}
I have a custom button on the Event to open a pdf with info from event and related task notes. I need to recreate it as an OnClick JavaScript, so that if the Event field '"Approved by:" is blank they receive an alert, but I cannot seem to get to right. I have tried several different senarios and keep getting different errors.

{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")} 

IF(ISPICKVAL(!Event.Approved_by__c, "NULL")){ 
   alert("Pre Meeting Notes Need to be Approved First");
}
 else 
{
    window.location = 'apex/EventMeetingNotes';
}

I'm trying to add this extension that a friend wrote, but receive Error: Compile Error: Type already defined: UpdateChangedFieldsController at line 3 column 15

I removed "class", but then received Error: Compile Error: Variable does not exist: record.Id at line 8 column 57

I was told:"You'll just add it as an extension on the page: apex:page standardController="blah" extensions="UpdateChangedFieldsController. And just call the savechanges method to save the changes."

Did I mention I am NOT a developer, I try, but my brain just doesn't seem to understand coding.

I'm on a deadline to make this work, so any help is much appreciated.

UpdateChangedFieldsController.cls

public class UpdateChangedFieldsController {
 SObject oldRecord, currentRecord;
 public class UpdateChangedFieldsController(ApexPages.StandardController controller) {
  oldRecord = controller.getRecord().clone();
  currentRecord = controller.getRecord();
 }
 public PageReference saveChanges() {
  SObject newClone = record.getSObjectType().newSObject(record.Id);
  Map<String, Object> 
   oldValues = oldRecord.getPopulatedFieldsAsMap(),
   newValues = currentRecord.getPopulatedFieldsAsMap();
  for(String key: newValues) {
   if(newValues.get(key) != oldValues.get(key)) {
    newClone.put(key, newValues.get(key));
   }
  }
  try {
   upsert newClone;
   return new ApexPages.StandardController(newClone).view();
  } catch(Exception e) {
   return null;
  }
 }
}

Hi All,

Just so I'm clear, I am not a developer. I can kind of read it and make small changes, but trying to learn to write it gives me a headache.

I have a vf page that was created for me, but when a Save is done it is saving all fields instead of just the fields that were edited. This is causing issues of data being deleted because the change was made in a record and not on the vf page. I hope that made sense. 

Here is the page and controller. I do hope that someone can help with a small change to this code and a whole new page doesn't have to be created.
I cannot paste all code with the limit of 32,000 characters.

<apex:page controller="MyOpenTasksController">
    <apex:includeScript value="{!$Resource.JS_Busy_Indicator}"/>
    <script>
        function showFilterData(){
            filterData();
        }
        function setUser(){
            setUser();
        }
        var xval;
        function block_viewport() {
            xval=getBusyOverlay('viewport',{color:'black', opacity:0.35, text:'processing...', style:'text-shadow: 0 0 3px black;font-weight:bold;font-size:12px;color:white'},{color:'#fff', size:75, type:'o'});
        }
    </script>
    <apex:form id="frm">
    
    <apex:actionFunction name="filterData" action="{!filterTaskData}" reRender="frm,pgBlock" oncomplete="xval.remove();"/>
    <apex:actionFunction name="setUser" action="{!setCurrentUser}" reRender="frm,pgBlock" oncomplete="xval.remove();"/>
    
    <apex:pageBlock title="My Open Tasks" id="pgBlock">
    
    
        <apex:pageBlockButtons >
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Update To Tomorrow" action="{!updateToTomorrow}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Save" action="{!saveChanges}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>            
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Cancel" action="{!cancelChanges}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>
        </apex:pageBlockButtons>
        <br/>
        <apex:outputPanel >
            
            
Controller:
public with sharing class MyOpenTasksController {

    public String eventObject { get; set; }
    public Integer recordsSize {get;set;}
    public Integer totalNumberOfPages { get; set; }
    public Integer pageNumber {get;set;}
    public Boolean hasNext {get;set;}
    public Boolean hasPrevious {get;set;}
    
    public List<SelectOption> contactAttendeeList{get;set;}
    public List<SelectOption> mailingStateList{get;set;}
    public List<SelectOption> activeUsersList{get;set;}
    public Id selectedUserId {get;set;}
    public boolean showUserPicklist {get;set;}
    public String selectedAttendee{get;set;}
    public String selectedState{get;set;}
    public string selectedPriority {get;set;}
    public string selectedTimezone {get;set;}
    
    public List<Task> taskList {get;set;}
    
    private List<Id> taskListWithAllRecords;
    private Integer noOfRecordsPerPage = 50;
    
    public MyOpenTasksController(){
        activeUsersList = new List<SelectOption>();
        
        showUserPicklist = false;
        for(User_Information__c usrInfo : User_Information__c.getAll().values()){
            if(usrInfo.User_Id__c == String.valueOf(UserInfo.getUserId()).substring(0,15)){
                showUserPicklist = true;
            }
        }
        selectedUserId = UserInfo.getUserId();
        activeUsersList.add(new SelectOption(UserInfo.getUserId(),'Current User'));
        for(User usr : [Select Id, Name from User where IsActive = true]){
            if(usr.id != UserInfo.getUserId()){
                activeUsersList.add(new SelectOption(usr.Id,usr.Name));
            }
        }
        populateSelectOptions();
        populateTaskData();
    }
    
    private void populateTaskData(){
        recordsSize = 0;
        totalNumberOfPages = 0;
        pageNumber = 0;
        hasNext = false;
        hasPrevious = false;
        
        //taskList = new List<Task>();
        taskListWithAllRecords = new List<Id>();
        // String Query to have a list of cases for a respective End-user.
        //String soql = 'Select ActivityDate, Status, Priority, Atendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Task_Attendee__c from Task where IsClosed = false AND OwnerID =:selectedUserId';
        
        String soql = 'Select id from Task where IsClosed = false AND OwnerID =:selectedUserId';
        if(selectedPriority == null && selectedTimezone == null  && selectedAttendee == null  && selectedState == null){
            
        }
        else if (selectedPriority != null && selectedTimezone == null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority '; 
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone '; 
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Attendee__c = :selectedAttendee '; 
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.MailingState = :selectedState '; 
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone '; 
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee '; 
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Attendee__c = :selectedAttendee ';
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee ';
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else{
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        
        // Passing the String array to a list with Selected field sorting.
        for(Task tsk : Database.query(soql + ' order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST')){
            taskListWithAllRecords.add(tsk.id);
        }
        
        recordsSize = taskListWithAllRecords.size();
        if(Math.mod(recordsSize,noOfRecordsPerPage) != 0){
            totalNumberOfPages = (recordsSize / noOfRecordsPerPage) + 1;
        }
        else{
            totalNumberOfPages = recordsSize / noOfRecordsPerPage;
        }
        Set<Id> taskIds = new Set<Id>();
        if(recordsSize > noOfRecordsPerPage){
            for(Integer i=pageNumber*noOfRecordsPerPage ; i<noOfRecordsPerPage ; i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
            hasNext = true;
        }
        else{
            taskIds.addAll(taskListWithAllRecords);
        }
        pageNumber++;
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }
    
    private void populateSelectOptions(){
        contactAttendeeList = new List<SelectOption>();
        contactAttendeeList.add(new SelectOption('','---None---'));
        
        mailingStateList = new List<SelectOption>();
        mailingStateList.add(new SelectOption('','---None---'));
        Set<String> setOfAttendee = new Set<String>();
        Set<String> setOfStates = new Set<String>();
        for(Task tsk : [Select Attendee__c,Dummy_Contact__r.Task_Attendee__c, Dummy_Contact__r.MailingState from Task where IsClosed = false AND OwnerID =:selectedUserId]){
            if(tsk.Attendee__c != null){
                setOfAttendee.add(tsk.Attendee__c);
            }
            if(tsk.Dummy_Contact__r.MailingState != null){
                setOfStates.add(tsk.Dummy_Contact__r.MailingState);
            }
        }
        if(setOfAttendee.size() > 0){
            List<String> sortedListOfAttendee = new List<String>();
            sortedListOfAttendee.addAll(setOfAttendee);
            sortedListOfAttendee.sort();
            for(String attendee : sortedListOfAttendee){
                contactAttendeeList.add(new SelectOption(attendee,attendee));
            }
        }
        if(setOfStates.size() > 0){
            List<String> sortedListOfStates = new List<String>();
            sortedListOfStates.addAll(setOfStates);
            sortedListOfStates.sort();
            for(String state : sortedListOfStates){
                mailingStateList.add(new SelectOption(state, state ));
            }
        }
    }
    
    // returns the previous page of records
    public void previous() {
        hasNext = true;
        //taskList = new List<Task>();
        Set<Id> taskIds = new Set<Id>();
        pageNumber--;
        for(Integer i= (pageNumber-1)*noOfRecordsPerPage; i<noOfRecordsPerPage*pageNumber ; i++){
            taskIds.add(taskListWithAllRecords[i]);
        }
        if(pageNumber > 1){
            hasPrevious = true;
        }
        else{
            hasPrevious = false;
        }
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }

    // returns the next page of records
    public void next() {
        hasPrevious = true;
        //taskList = new List<Task>();
        Set<Id> taskIds = new Set<Id>();
        if((pageNumber+1)*noOfRecordsPerPage < taskListWithAllRecords.size()){
            for(Integer i = pageNumber*noOfRecordsPerPage ; i<(pageNumber+1)*noOfRecordsPerPage ;i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
        }
        else{
            for(Integer i=pageNumber*noOfRecordsPerPage ; i<recordsSize ;i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
            hasNext = false;
        }
        pageNumber++;
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }
    
    public void sortData() {
        // simply toggle the direction
        sortDirection = sortDirection.equals('asc') ? 'desc' : 'asc';

        populateTaskData();
    }
    
    // the current sort direction. defaults to asc
    public String sortDirection {
        // To set a Direction either in ascending order or descending order.
        get  { if (sortDirection == null) {  sortDirection = 'asc'; } return sortDirection;}
        set;
    }

    // the current field to sort by. defaults to last name
    public String sortExpression {
        // To set a Field for sorting.
        get  { if (sortExpression == null) {sortExpression = 'ActivityDate'; } return sortExpression;  }
        set;
    } 
    
    public PageReference filterTaskData() {
        populateTaskData();
        return null;
    }
    
    public PageReference updateToTomorrow() {
        DateTime dateToBeChanged = system.Today().addDays(1);
        
        Datetime dt = DateTime.newInstance(System.today(), Time.newInstance(0, 0, 0, 0));
        String dayOfWeek=dt.format('EEEE');
        
        if(dayOfWeek == 'Friday'){
            dateToBeChanged = system.Today().addDays(3);
        }
        else if(dayOfWeek == 'Saturday'){
            dateToBeChanged = system.Today().addDays(2);
        }
        List<Task> listOfTaskToUpdate = new List<Task>();
        for(Task tsk : [Select ActivityDate from Task where IsClosed = false AND OwnerID =:selectedUserId]){
            if(tsk.ActivityDate <= system.today()){
                tsk.ActivityDate = Date.valueOf(dateToBeChanged);
                listOfTaskToUpdate.add(tsk);
            }
        }
        
        if(listOfTaskToUpdate.size() > 0){
            update listOfTaskToUpdate;
        }
        return null;
    }
    
    public PageReference cancelChanges() {
        return null;
    }
    
    public PageReference saveChanges() {
        Set<Id> conIds = new Set<Id>();
        Set<Contact> setOfContacts = new Set<Contact>();
        List<Contact> listOfContactToUpdate = new List<Contact>();
        
        for(Task tsk : taskList){
            if(tsk.Dummy_Contact__c != null){
                conIds.add(tsk.Dummy_Contact__c);
            }
        }
        for(Contact con : [Select Name,Title, Key_Exec__c, Exec_Type__c, Direct_Dial__c, MobilePhone, Phone, MailingState, Timezone__c, Attendee_Contact__c, Task_Attendee__c from Contact where id in :conIds]){
            for(Task tsk : taskList){
                if(tsk.Dummy_Contact__c == con.id){
                    con.Title = tsk.Dummy_Contact__r.Title;
                    con.Key_Exec__c = tsk.Dummy_Contact__r.Key_Exec__c;
                    con.Exec_Type__c = tsk.Dummy_Contact__r.Exec_Type__c;
                    con.Direct_Dial__c = tsk.Dummy_Contact__r.Direct_Dial__c;
                    con.MobilePhone = tsk.Dummy_Contact__r.MobilePhone;
                    con.Phone = tsk.Dummy_Contact__r.Phone;
                    con.MailingState = tsk.Dummy_Contact__r.MailingState;
                    con.Timezone__c = tsk.Dummy_Contact__r.Timezone__c;
                    setOfContacts.add(con);
                }
            }
        }
        if(setOfContacts.size() > 0){
            listOfContactToUpdate.addAll(setOfContacts);
            update listOfContactToUpdate;
        }
        
        if(taskList.size() > 0){
            update taskList;
        }
        return null;
    }
    public PageReference setCurrentUser() {
        populateSelectOptions();
        populateTaskData();
        return null;
    }
}
Hello Experts, 

I am trying to figure out how to get the DATE/TIME format to look like this: MM-DD-YYY HH:MM AM/PM. Currently it is all wrong, looking like this: 2016-10-11 19:20:33

Here is my code currently.

if(updateTask.Description != null){
                            updateTask.Description += '\n' + newTask.CreatedDate + ' ' + newTask.Description;
                        }
                        else{
                            updateTask.Description = newTask.CreatedDate + ' ' + newTask.Description;
I have a custom object, Task Helper, with two fields, "Next Step" Data Type = Long Text Area and "Related Meeting" Data Type = Lookup(Task Helper). The field "Next Step" has been added to Custom VF page, a Task.
 
My problem is running a report that can pull in Activity fields and the "Next Step" field.
 
I've tried CRT to no avail.
 
Any ideas? I asked Steve Molis and he said I lost him at Visualforce.
I cannot figure out what Im doing wrong. I need it to have Priority of Low if no Direct Dial and/or Mobile on Contact and Medium if there is Direct Dial AND/OR Mobile. Medium works but not Low.

Any ideas? Help is very much appreciated.

trigger createTask on Contact (after insert, after update) {
    List<Task> listOfTaskToBeInserted = new List<Task>();
    Task newtask;
    for(Contact con : trigger.new){
        if((trigger.isInsert && (con.Direct_Dial__c == '' || con.MobilePhone == '')) || (trigger.isUpdate && trigger.oldMap.get(con.id).Exec_Type__c != con.Exec_Type__c && (con.Exec_Type__c == 'Key Exec' || con.Exec_Type__c == 'Approved Exec'))){
            newtask = new Task();
            newtask.WhatId = con.AccountId;
            newtask.Subject = 'Target';
            newtask.whoId = con.id;
            newtask.ActivityDate = system.today();
            newTask.Status = 'Open';
            newTask.Attendee__c = con.Task_Attendee__c;
            if(con.Direct_Dial__c == ''){
               newTask.Priority = 'Low';
            }
            else{
                newTask.Priority = 'Medium';
            }
           listOfTaskToBeInserted.add(newTask);
        }
    }
    if(listOfTaskToBeInserted.size() > 0){
        insert listOfTaskToBeInserted;
    }
}
I'm trying to update the Task Helper record with the Related Event ID and keep getting this error.

Any help would be appreciated.
Thank you,

trigger UpdatedRelatedEventField on Task_Helper__c (before insert, before update) {
    for(Task Helper record: Trigger.new) {
        try {
            record.Related_Event__c = Id.valueOf(record.Related_Event__c);
        } catch(Exception e) {
            
        }
    }
}
I need the fields "Meeting Rating" and "Rating Notes" to be Read Only on this page only. I know how to do it with FLS, but not for a vf page.

Also, once the 'Post-Meeting Notes' task has been created and saved, if you you edit it, it shows a different page layout; (Pre-Meeting Notes layout).

<apex:page standardController="Task" extensions="ViewTaskExtension">
    <apex:sectionHeader title="Task" subtitle="{!Task.Subject}" />
    <apex:form >
        <apex:pageMessages ></apex:pageMessages>
        <apex:pageBlock title="Task Edit"  id="thePageBlock" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" value="Edit"/>
                <apex:commandButton action="{!delete}" value="Delete"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Task Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.OwnerId}"/>
                <apex:outputField value="{!Task.Attendee__c}"/>
                <apex:outputField value="{!Task.Subject}"/>
                <apex:outputField value="{!Task.WhatId}"/>
                <apex:outputField value="{!Task.ActivityDate}"/>
                <apex:outputField value="{!Task.WhoId}"/>
                <apex:outputField value="{!Task.Description}"/>
                <apex:outputField value="{!taskHelper.Next_Steps__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputfield value="{!Task.Meeting_Rating__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputfield value="{!Task.Rating_Notes__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputField value="{!Task.Date_Approved__c}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Approved_by__c}" rendered="{!showPreTaskFields}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Additional Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.Priority}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Meeting_Notes__c}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Status}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="System Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.CreatedById}"/>
                <apex:outputField value="{!Task.LastModifiedById}"/>
                <apex:outputField value="{!Task.Related_Event__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller
public with sharing class CreatePostMeetingTaskExtension {
    
    private Event currentEvent;
    public Task postMeetingTask {get;set;}
    public Task_Helper__c taskHelper {get;set;}
    public CreatePostMeetingTaskExtension(ApexPages.StandardController controller) {
        this.currentEvent = (Event)controller.getRecord();
        currentEvent = [Select OwnerId,Attendee__c,WhatId,WhoId,Meeting_Rating__c,Rating_Notes__c from Event where Id =: currentEvent.id];
        
        taskHelper = new Task_Helper__c();
        
        postMeetingTask = new Task();
        postMeetingTask.OwnerId = currentEvent.OwnerId;
        postMeetingTask.Attendee__c = currentEvent.Attendee__c;
        postMeetingTask.WhatId = currentEvent.WhatId;
        postMeetingTask.WhoId = currentEvent.WhoId;
        postMeetingTask.Meeting_Rating__c = currentEvent.Meeting_Rating__c;
        postMeetingTask.Rating_Notes__c = currentEvent.Rating_Notes__c;
        postMeetingTask.Subject = 'Post Meeting Notes';
        postMeetingTask.Status = 'Completed';
        postMeetingTask.Related_Event__c = currentEvent.id;
    }
    public PageReference save(){
        insert taskHelper;
        postMeetingTask.Task_Helper__c = taskHelper.id;
        insert postMeetingTask;
        return new PageReference('/'+postMeetingTask.id);
    }
}
I have 1 User that is receiving this error and i do not know why. I have even created a new profile; didn't work. So I created a new user for him; still get same error.
This is a visualforce page of the users tasks that can be modified and saed on the page without having to open the Task.


Attempt to de-reference a null object
Error is in expression '{!saveRecord}' in component <apex:commandButton> in page allopentasks: Class.TaskController.saveRecord: line 145, column 1
I'll start by saying, I am not a developer by any means. I'm still plugging along trying to finish a vf page started by a freelance developer that left me hanging. I have done a lot of research, but cannot seem to figure out how to be able to click on the column headers and have it (sortDirection='ASC','▼','▲').

Any help is enormously appreciated. I'm going crazy with this thing.

My Controller:
public with sharing class MeetingBacklogController
{

    public String getSortDirection() {
        return null;
    }


    public String sortExpression { get; set; }

    public PageReference ViewData() {
        return null;
    }


    public String events { get; set; }
    public List<Event> eventsList{get; set;}
    public Map<Id, sObject> relatedRecords{get; set;}
    
    private Map<Id, Event> originalEventsMap;
    
    public MeetingBacklogController()
    {
        init(true);
    }
    
    private void init(Boolean updateUI)
    {
        Set<String> meetingProgressionValues=new Set<String>();
        for(PicklistEntry entry: Event.Meeting_Progression__c.getDescribe().getPicklistValues())
        {
            if(entry.getValue().startsWithIgnoreCase('M') || entry.getValue().startsWithIgnoreCase('Conf'))
            {
                meetingProgressionValues.add(entry.getValue());
            }
        }
        originalEventsMap=new Map<Id, Event>([
            SELECT Id, Set_By__c, Attendee__c, Meeting_Progression__c, Exec_Invites__c,
            Client_Invites__c, Meeting_Status__c,
            ActivityDate, StartDateTime, Subject, AccountId, Account.Name, WhoId, Who.Name, Who.Title,
            Location, Meeting_Location__c, IsChild
            FROM Event
            WHERE StartDateTime=NEXT_N_DAYS:90
            AND Meeting_Progression__c IN :meetingProgressionValues
            AND Meeting_Status__c NOT IN ('CCLP','CP','CC','MP','MC','AM')
            AND IsChild=false
        ]);
               
        relatedRecords=new Map<Id, SObject>();
        for(Event record: originalEventsMap.values())
        {
            relatedRecords.put(record.WhoId, Null);
        }
        relatedRecords.putAll([SELECT Title FROM Lead WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.putAll([SELECT Title FROM Contact WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.put(Null, new Contact());
        
        eventsList=new List<Event>();
        if(updateUI)
        {
            eventsList=originalEventsMap.values().deepClone(true, true, true);
            eventsList.sort();
        }
    }
    
    public void refresh()
    {
        init(true);
    }
    
    public void save()
    {
        List<Event> eventsToBeUpdateList=new List<Event>();
        
        for(Integer i=0; i<originalEventsMap.values().size(); i++)
        {
            for(Integer j=0; j<eventsList.size(); j++)
            {
                if(originalEventsMap.values()[i].Id==eventsList[j].Id && originalEventsMap.values()[i]!=eventsList[j])
                {
                    eventsToBeUpdateList.add(eventsList[j]);
                    system.debug('eventsList[j]---->'+eventsList[j]);
                    break;
                }
            }
        }
        Boolean updateUI=true;
        
        try
        {
            Integer numberOfRecordsUpdated=0;
            for(Database.SaveResult result: Database.update(eventsToBeUpdateList, false))
            {
                updateUI&=result.isSuccess();
                if(result.isSuccess())
                {
                    numberOfRecordsUpdated=numberOfRecordsUpdated+1;
                }
            }
            
            init(updateUI);
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, numberOfRecordsUpdated+' record'+(numberOfRecordsUpdated==1?'':'s')+' saved.'));
        }
        catch(Exception e)
        {
            ApexPages.addMessages(e);
        }
    }
}

VF Page:

<apex:page controller="MeetingBacklogController" tabStyle="Event">
    <apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
    <apex:form id="form">
         <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" id="saveButton" value="Save"  reRender="form" status="status" />
                <apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
                <apex:actionStatus startText="Updating..." id="status" />
            </apex:pageBlockButtons>
                   <apex:pageMessages />
            <apex:pageMessage severity="info" rendered="{!eventsList.size=0}">
                No records found
                    </apex:pageMessage>
            <apex:pageBlockTable rendered="{!eventsList.size>0}" value="{!eventsList}" var="event">
                <apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" >
                <apex:outputField value="{!event.Attendee__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}">
                <apex:outputField value="{!event.Meeting_Progression__c}" >
                        </apex:outputField>
               </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Client_Invites__c.Label}">
                    <apex:outputField value="{!event.Client_Invites__c}" >
                        </apex:outputField>
               </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invites__c.Label}">
                    <apex:outputField value="{!event.Exec_Invites__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
                    <apex:outputField value="{!event.Meeting_Status__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:facet name="header">   
           <apex:commandLink action="{!ViewData}" value="StartDateTime{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}" id="cmdSort">
             <apex:param value="name" name="column" assignTo="{!sortExpression}" ></apex:param>
           </apex:commandLink>
         </apex:facet>
                <apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}">
                        <apex:outputField value=" {!event.StartDateTime}" >
                    </apex:outputField>
                </apex:column>
                     <apex:column headervalue="{!$ObjectType.Event.fields.Subject.Label}">
                        <apex:outputField value="{!event.Subject}" label="Subject" >
                        </apex:outputField>
            </apex:column>
                    <apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" >
                    <apex:outputField value="{!event.Location}" >
                    </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Subject.Label}" value="{!event.Subject}" />
                 <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
                 <apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
                  <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Location__c.Label}" >
                <apex:outputField value=" {!event.Meeting_Location__c}" >
                </apex:outputField>
                         </apex:column>
                <apex:inlineEditSupport event="ondblClick"
                            showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Regards,
Very frustrated Admin
I have a VF Page to display all open Events and would like to be able to click the Subject and have the Event open, preferably in a new tab. Right now it's just editable.

<apex:page controller="MeetingBacklogController" tabStyle="Event">
    <apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
    <apex:form id="form">
         <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" id="saveButton" value="Save"  reRender="form" status="status" />
                <apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
                <apex:actionStatus startText="Updating..." id="status" />
            </apex:pageBlockButtons>
                   <apex:pageMessages />
            <apex:pageMessage severity="info" rendered="{!eventsList.size=0}">
                No records found
                    </apex:pageMessage>
            <apex:pageBlockTable rendered="{!eventsList.size>0}" value="{!eventsList}" var="event">
                <apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" >
                <apex:outputField value="{!event.Attendee__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}">
                <apex:outputField value="{!event.Meeting_Progression__c}" >
                        </apex:outputField>
               </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Client_Invites__c.Label}">
                    <apex:outputField value="{!event.Client_Invites__c}" >
                        </apex:outputField>
               </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invites__c.Label}">
                    <apex:outputField value="{!event.Exec_Invites__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
                    <apex:outputField value="{!event.Meeting_Status__c}" >
                        </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}" >
                        <apex:outputField value=" {!event.StartDateTime}" >
                    </apex:outputField>
                </apex:column>
                     <apex:column headervalue="{!$ObjectType.Event.fields.Subject.Label}">
                        <apex:outputField value="{!event.Subject}" label="Subject" >
                        </apex:outputField>
            </apex:column>
                    <apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" >
                    <apex:outputField value="{!event.Location}" >
                    </apex:outputField>
                </apex:column>
                 <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
                 <apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
                  <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Location__c.Label}" >
                <apex:outputField value=" {!event.Meeting_Location__c}" >
                </apex:outputField>
                         </apex:column>
                <apex:inlineEditSupport event="ondblClick"
                            showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
=====================================================================================================
Controller:

public with sharing class MeetingBacklogController
{

    public String events { get; set; }
    public List<Event> eventsList{get; set;}
    public Map<Id, sObject> relatedRecords{get; set;}
    
    private Map<Id, Event> originalEventsMap;
    
    public MeetingBacklogController()
    {
        init(true);
    }
    
    private void init(Boolean updateUI)
    {
        Set<String> meetingProgressionValues=new Set<String>();
        for(PicklistEntry entry: Event.Meeting_Progression__c.getDescribe().getPicklistValues())
        {
            if(entry.getValue().startsWithIgnoreCase('M') || entry.getValue().startsWithIgnoreCase('Conf'))
            {
                meetingProgressionValues.add(entry.getValue());
            }
        }
        originalEventsMap=new Map<Id, Event>([
            SELECT Id, Set_By__c, Attendee__c, Meeting_Progression__c, Exec_Invites__c,
            Client_Invites__c, Meeting_Status__c,
            ActivityDate, StartDateTime, Subject, AccountId, Account.Name, WhoId, Who.Name, Who.Title,
            Location, Meeting_Location__c, IsChild
            FROM Event
            WHERE StartDateTime=NEXT_N_DAYS:90
            AND Meeting_Progression__c IN :meetingProgressionValues
            AND IsChild=false
        ]);
               
        relatedRecords=new Map<Id, SObject>();
        for(Event record: originalEventsMap.values())
        {
            relatedRecords.put(record.WhoId, Null);
        }
        relatedRecords.putAll([SELECT Title FROM Lead WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.putAll([SELECT Title FROM Contact WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.put(Null, new Contact());
        
        eventsList=new List<Event>();
        if(updateUI)
        {
            eventsList=originalEventsMap.values().deepClone(true, true, true);
            eventsList.sort();
        }
    }
    
    public void refresh()
    {
        init(true);
    }
    
    public void save()
    {
        List<Event> eventsToBeUpdateList=new List<Event>();
        
        for(Integer i=0; i<originalEventsMap.values().size(); i++)
        {
            for(Integer j=0; j<eventsList.size(); j++)
            {
                if(originalEventsMap.values()[i].Id==eventsList[j].Id && originalEventsMap.values()[i]!=eventsList[j])
                {
                    eventsToBeUpdateList.add(eventsList[j]);
                    system.debug('eventsList[j]---->'+eventsList[j]);
                    break;
                }
            }
        }
        Boolean updateUI=true;
        
        try
        {
            Integer numberOfRecordsUpdated=0;
            for(Database.SaveResult result: Database.update(eventsToBeUpdateList, false))
            {
                updateUI&=result.isSuccess();
                if(result.isSuccess())
                {
                    numberOfRecordsUpdated=numberOfRecordsUpdated+1;
                }
            }
            
            init(updateUI);
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, numberOfRecordsUpdated+' record'+(numberOfRecordsUpdated==1?'':'s')+' saved.'));
        }
        catch(Exception e)
        {
            ApexPages.addMessages(e);
        }
    }
}
When editing the field I have to click out of the field so it turns orange, only then will the change save. Hope that makes sense. I really am not sure what I'm doing. I'm trying to fix and clean up what a freelance developer created.

Any ideas or help is greatly appriciated.

VF Page:

<apex:page controller="MeetingBacklogController" tabStyle="Event">
    <apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
    <apex:form id="form">
    <apex:pageBlock mode="inlineedit" >
            <apex:pageBlockButtons >
                <apex:commandButton rendered="{!eventsList.size>0}" value="Save" action="{!save}" reRender="form" status="status" />
                <apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
                <apex:actionStatus startText="Updating..." id="status" />
            </apex:pageBlockButtons>
            
            <apex:pageMessages />
            <apex:pageMessage severity="info" rendered="{!eventsList.size=0}">
                No records found
            </apex:pageMessage>
            <apex:pageBlockTable rendered="{!eventsList.size>0}" value="{!eventsList}" var="event">
                <apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" >
                <apex:outputField value="{!event.Attendee__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}">
                <apex:outputField value="{!event.Meeting_Progression__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Client_Invites__c.Label}">
                    <apex:outputField value="{!event.Client_Invites__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invites__c.Label}">
                    <apex:outputField value="{!event.Exec_Invites__c}" >
                         </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
                    <apex:outputField value="{!event.Meeting_Status__c}" >
                         </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" >
                <apex:outputField value="{!event.Location}" >
                         </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}" >
                <apex:outputField value=" {!event.StartDateTime}" >
                <apex:inlineEditSupport />
                 </apex:outputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Controller:

public with sharing class MeetingBacklogController
{

    public String events { get; set; }
    public List<Event> eventsList{get; set;}
    public Map<Id, sObject> relatedRecords{get; set;}
    
    private Map<Id, Event> originalEventsMap;
    
    public MeetingBacklogController()
    {
        init(true);
    }
    
    private void init(Boolean updateUI)
    {
        Set<String> meetingProgressionValues=new Set<String>();
        for(PicklistEntry entry: Event.Meeting_Progression__c.getDescribe().getPicklistValues())
        {
            if(entry.getValue().startsWithIgnoreCase('M') || entry.getValue().startsWithIgnoreCase('Conf'))
            {
                meetingProgressionValues.add(entry.getValue());
            }
        }
        
        originalEventsMap=new Map<Id, Event>([
            SELECT Id, Set_By__c, Attendee__c, Meeting_Progression__c, Exec_Invites__c,
                Client_Invites__c, Meeting_Status__c,
            ActivityDate, StartDateTime, AccountId, Account.Name, WhoId, Who.Name, Who.Title,
            Location, IsChild
            FROM Event
            WHERE StartDateTime=NEXT_N_DAYS:90
            AND Meeting_Progression__c IN :meetingProgressionValues
            AND Meeting_Status__c NOT IN ('CCLP','CP','CC','MP','MC','AM')
            AND IsChild=false
        ]);
        
        relatedRecords=new Map<Id, SObject>();
        for(Event record: originalEventsMap.values())
        {
            relatedRecords.put(record.WhoId, Null);
        }
        relatedRecords.putAll([SELECT Title FROM Lead WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.putAll([SELECT Title FROM Contact WHERE Id IN :relatedRecords.keySet()]);
        relatedRecords.put(Null, new Contact());
        
        eventsList=new List<Event>();
        if(updateUI)
        {
            eventsList=originalEventsMap.values().deepClone(true, true, true);
            eventsList.sort();
        }
    }
    
    public void refresh()
    {
        init(true);
    }
    
    public void save()
    {
        List<Event> eventsToBeUpdateList=new List<Event>();
        
        for(Integer i=0; i<originalEventsMap.values().size(); i++)
        {
            for(Integer j=0; j<eventsList.size(); j++)
            {
                if(originalEventsMap.values()[i].Id==eventsList[j].Id && originalEventsMap.values()[i]!=eventsList[j])
                {
                    eventsToBeUpdateList.add(eventsList[j]);
                    system.debug('eventsList[j]---->'+eventsList[j]);
                    break;
                }
            }
        }
        Boolean updateUI=true;
        
        try
        {
            Integer numberOfRecordsUpdated=0;
            for(Database.SaveResult result: Database.update(eventsToBeUpdateList, false))
            {
                updateUI&=result.isSuccess();
                if(result.isSuccess())
                {
                    numberOfRecordsUpdated=numberOfRecordsUpdated+1;
                }
            }
            
            init(updateUI);
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, numberOfRecordsUpdated+' record'+(numberOfRecordsUpdated==1?'':'s')+' saved.'));
        }
        catch(Exception e)
        {
            ApexPages.addMessages(e);
        }
    }
}
A freelance developer left me hanging by not finishing the job. I really need to have this page not include all of the IsChild Events. Most every Event created in our org has invitees, but this makes it very difficult to know which is the parent on this vf page.
This is what I have so far. really hoping someone can help.

<apex:page controller="MeetingBacklogController" tabStyle="Event">
    <apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
    <apex:form id="form">
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton rendered="{!events.size>0}" value="Save" action="{!save}" reRender="form" status="status" />
                <apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
                <apex:actionStatus startText="Updating..." id="status" />
            </apex:pageBlockButtons>

            <apex:pageMessages />
            <apex:pageMessage severity="info" rendered="{!events.size=0}">
                No records found
            </apex:pageMessage>
            <apex:pageBlockTable rendered="{!events.size>0}" value="{!events}" var="event">
                <apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" value="{!event.Attendee__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}" value="{!event.Meeting_Progression__c}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.Client_Invite__c.Label}">
                    <apex:inputField value="{!event.Client_Invite__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invite__c.Label}">
                    <apex:inputField value="{!event.Exec_Invite__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Accepted__c.Label}">
                    <apex:inputField value="{!event.Exec_Accepted__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Exec_Tentative__c.Label}">
                    <apex:inputField value="{!event.Exec_Tentative__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
                    <apex:inputField value="{!event.Meeting_Status__c}" />
                </apex:column>
                                <apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" value="{!event.Location}" />
                <apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}" value="{!event.StartDateTime}" />
                <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
                <apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Is it possible to have this trigger only for specified profiles?


trigger EventDelete on Event (before delete)

    {

     if (Trigger.isDelete) {

           for (Event sb : Trigger.old)

      {

             sb.addError('Cannot delete an Event');

      }

     }}
I'm sure this is a simple question, how can I get specific fields into the 2nd column?

<apex:pageBlockSection columns="1" title="Account Details" collapsible="false">
                    <apex:outputField value="{!Account.Name}" />
                </apex:pageBlockSection>
                <apex:pageBlockSection >
                    <apex:outputField value="{!Account.Website}" />
                    <apex:outputField value="{!Account.NumberOfEmployees}" />
                    <apex:outputField value="{!Account.AnnualRevenue}" />
                </apex:pageBlockSection>
                <br/>
                <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!Account.Description}" />

User-added image
I need to have a line break between Website and Description, but this isn't working as expected.

<apex:outputField value="{!Account.Website}" />
                </apex:pageBlockSection>
                <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!Account.Description}" />
I have a custom button on the Event to open a pdf with info from event and related task notes. I need to recreate it as an OnClick JavaScript, so that if the Event field '"Approved by:" is blank they receive an alert, but I cannot seem to get to right. I have tried several different senarios and keep getting different errors.

{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")} 

IF(ISPICKVAL(!Event.Approved_by__c, "NULL")){ 
   alert("Pre Meeting Notes Need to be Approved First");
}
 else 
{
    window.location = 'apex/EventMeetingNotes';
}
Hi All,

Just so I'm clear, I am not a developer. I can kind of read it and make small changes, but trying to learn to write it gives me a headache.

I have a vf page that was created for me, but when a Save is done it is saving all fields instead of just the fields that were edited. This is causing issues of data being deleted because the change was made in a record and not on the vf page. I hope that made sense. 

Here is the page and controller. I do hope that someone can help with a small change to this code and a whole new page doesn't have to be created.
I cannot paste all code with the limit of 32,000 characters.

<apex:page controller="MyOpenTasksController">
    <apex:includeScript value="{!$Resource.JS_Busy_Indicator}"/>
    <script>
        function showFilterData(){
            filterData();
        }
        function setUser(){
            setUser();
        }
        var xval;
        function block_viewport() {
            xval=getBusyOverlay('viewport',{color:'black', opacity:0.35, text:'processing...', style:'text-shadow: 0 0 3px black;font-weight:bold;font-size:12px;color:white'},{color:'#fff', size:75, type:'o'});
        }
    </script>
    <apex:form id="frm">
    
    <apex:actionFunction name="filterData" action="{!filterTaskData}" reRender="frm,pgBlock" oncomplete="xval.remove();"/>
    <apex:actionFunction name="setUser" action="{!setCurrentUser}" reRender="frm,pgBlock" oncomplete="xval.remove();"/>
    
    <apex:pageBlock title="My Open Tasks" id="pgBlock">
    
    
        <apex:pageBlockButtons >
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Update To Tomorrow" action="{!updateToTomorrow}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Save" action="{!saveChanges}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>            
            <apex:commandButton onclick="block_viewport();" oncomplete="xval.remove();" value="Cancel" action="{!cancelChanges}" reRender="frm,pgBlock" disabled="{!Not(taskList.size > 0)}"/>
        </apex:pageBlockButtons>
        <br/>
        <apex:outputPanel >
            
            
Controller:
public with sharing class MyOpenTasksController {

    public String eventObject { get; set; }
    public Integer recordsSize {get;set;}
    public Integer totalNumberOfPages { get; set; }
    public Integer pageNumber {get;set;}
    public Boolean hasNext {get;set;}
    public Boolean hasPrevious {get;set;}
    
    public List<SelectOption> contactAttendeeList{get;set;}
    public List<SelectOption> mailingStateList{get;set;}
    public List<SelectOption> activeUsersList{get;set;}
    public Id selectedUserId {get;set;}
    public boolean showUserPicklist {get;set;}
    public String selectedAttendee{get;set;}
    public String selectedState{get;set;}
    public string selectedPriority {get;set;}
    public string selectedTimezone {get;set;}
    
    public List<Task> taskList {get;set;}
    
    private List<Id> taskListWithAllRecords;
    private Integer noOfRecordsPerPage = 50;
    
    public MyOpenTasksController(){
        activeUsersList = new List<SelectOption>();
        
        showUserPicklist = false;
        for(User_Information__c usrInfo : User_Information__c.getAll().values()){
            if(usrInfo.User_Id__c == String.valueOf(UserInfo.getUserId()).substring(0,15)){
                showUserPicklist = true;
            }
        }
        selectedUserId = UserInfo.getUserId();
        activeUsersList.add(new SelectOption(UserInfo.getUserId(),'Current User'));
        for(User usr : [Select Id, Name from User where IsActive = true]){
            if(usr.id != UserInfo.getUserId()){
                activeUsersList.add(new SelectOption(usr.Id,usr.Name));
            }
        }
        populateSelectOptions();
        populateTaskData();
    }
    
    private void populateTaskData(){
        recordsSize = 0;
        totalNumberOfPages = 0;
        pageNumber = 0;
        hasNext = false;
        hasPrevious = false;
        
        //taskList = new List<Task>();
        taskListWithAllRecords = new List<Id>();
        // String Query to have a list of cases for a respective End-user.
        //String soql = 'Select ActivityDate, Status, Priority, Atendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Task_Attendee__c from Task where IsClosed = false AND OwnerID =:selectedUserId';
        
        String soql = 'Select id from Task where IsClosed = false AND OwnerID =:selectedUserId';
        if(selectedPriority == null && selectedTimezone == null  && selectedAttendee == null  && selectedState == null){
            
        }
        else if (selectedPriority != null && selectedTimezone == null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority '; 
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone '; 
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Attendee__c = :selectedAttendee '; 
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.MailingState = :selectedState '; 
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee == null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone '; 
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee '; 
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Attendee__c = :selectedAttendee ';
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone == null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee != null  && selectedState == null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee ';
        }
        else if(selectedPriority != null && selectedTimezone != null  && selectedAttendee == null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority != null && selectedTimezone == null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Priority = :selectedPriority AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else if(selectedPriority == null && selectedTimezone != null  && selectedAttendee != null  && selectedState != null){
            soql = soql + ' AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        else{
            soql = soql + ' AND Priority = :selectedPriority AND Dummy_Contact__r.Timezone__c = :selectedTimezone AND Attendee__c = :selectedAttendee AND Dummy_Contact__r.MailingState = :selectedState ';
        }
        
        // Passing the String array to a list with Selected field sorting.
        for(Task tsk : Database.query(soql + ' order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST')){
            taskListWithAllRecords.add(tsk.id);
        }
        
        recordsSize = taskListWithAllRecords.size();
        if(Math.mod(recordsSize,noOfRecordsPerPage) != 0){
            totalNumberOfPages = (recordsSize / noOfRecordsPerPage) + 1;
        }
        else{
            totalNumberOfPages = recordsSize / noOfRecordsPerPage;
        }
        Set<Id> taskIds = new Set<Id>();
        if(recordsSize > noOfRecordsPerPage){
            for(Integer i=pageNumber*noOfRecordsPerPage ; i<noOfRecordsPerPage ; i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
            hasNext = true;
        }
        else{
            taskIds.addAll(taskListWithAllRecords);
        }
        pageNumber++;
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }
    
    private void populateSelectOptions(){
        contactAttendeeList = new List<SelectOption>();
        contactAttendeeList.add(new SelectOption('','---None---'));
        
        mailingStateList = new List<SelectOption>();
        mailingStateList.add(new SelectOption('','---None---'));
        Set<String> setOfAttendee = new Set<String>();
        Set<String> setOfStates = new Set<String>();
        for(Task tsk : [Select Attendee__c,Dummy_Contact__r.Task_Attendee__c, Dummy_Contact__r.MailingState from Task where IsClosed = false AND OwnerID =:selectedUserId]){
            if(tsk.Attendee__c != null){
                setOfAttendee.add(tsk.Attendee__c);
            }
            if(tsk.Dummy_Contact__r.MailingState != null){
                setOfStates.add(tsk.Dummy_Contact__r.MailingState);
            }
        }
        if(setOfAttendee.size() > 0){
            List<String> sortedListOfAttendee = new List<String>();
            sortedListOfAttendee.addAll(setOfAttendee);
            sortedListOfAttendee.sort();
            for(String attendee : sortedListOfAttendee){
                contactAttendeeList.add(new SelectOption(attendee,attendee));
            }
        }
        if(setOfStates.size() > 0){
            List<String> sortedListOfStates = new List<String>();
            sortedListOfStates.addAll(setOfStates);
            sortedListOfStates.sort();
            for(String state : sortedListOfStates){
                mailingStateList.add(new SelectOption(state, state ));
            }
        }
    }
    
    // returns the previous page of records
    public void previous() {
        hasNext = true;
        //taskList = new List<Task>();
        Set<Id> taskIds = new Set<Id>();
        pageNumber--;
        for(Integer i= (pageNumber-1)*noOfRecordsPerPage; i<noOfRecordsPerPage*pageNumber ; i++){
            taskIds.add(taskListWithAllRecords[i]);
        }
        if(pageNumber > 1){
            hasPrevious = true;
        }
        else{
            hasPrevious = false;
        }
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }

    // returns the next page of records
    public void next() {
        hasPrevious = true;
        //taskList = new List<Task>();
        Set<Id> taskIds = new Set<Id>();
        if((pageNumber+1)*noOfRecordsPerPage < taskListWithAllRecords.size()){
            for(Integer i = pageNumber*noOfRecordsPerPage ; i<(pageNumber+1)*noOfRecordsPerPage ;i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
        }
        else{
            for(Integer i=pageNumber*noOfRecordsPerPage ; i<recordsSize ;i++){
                taskIds.add(taskListWithAllRecords[i]);
            }
            hasNext = false;
        }
        pageNumber++;
        
        String soqlQuery = 'Select ActivityDate, Status, Priority, Attendee__c, Dummy_Contact__c, WhatId,Dummy_Contact__r.Name,What.Name, Description, Dummy_Contact__r.Title, Dummy_Contact__r.Key_Exec__c, Dummy_Contact__r.Exec_Type__c, Dummy_Contact__r.Direct_Dial__c, Dummy_Contact__r.MobilePhone, Dummy_Contact__r.Phone, Dummy_Contact__r.MailingState, Dummy_Contact__r.Timezone__c, Dummy_Contact__r.Attendee_Contact__c, Dummy_Contact__r.Task_Attendee__c from Task where Id In :taskIds order by ' + sortExpression + ' ' + sortDirection  + ' NULLS LAST';
        taskList = new List<Task>();
        taskList = Database.query(soqlQuery);
    }
    
    public void sortData() {
        // simply toggle the direction
        sortDirection = sortDirection.equals('asc') ? 'desc' : 'asc';

        populateTaskData();
    }
    
    // the current sort direction. defaults to asc
    public String sortDirection {
        // To set a Direction either in ascending order or descending order.
        get  { if (sortDirection == null) {  sortDirection = 'asc'; } return sortDirection;}
        set;
    }

    // the current field to sort by. defaults to last name
    public String sortExpression {
        // To set a Field for sorting.
        get  { if (sortExpression == null) {sortExpression = 'ActivityDate'; } return sortExpression;  }
        set;
    } 
    
    public PageReference filterTaskData() {
        populateTaskData();
        return null;
    }
    
    public PageReference updateToTomorrow() {
        DateTime dateToBeChanged = system.Today().addDays(1);
        
        Datetime dt = DateTime.newInstance(System.today(), Time.newInstance(0, 0, 0, 0));
        String dayOfWeek=dt.format('EEEE');
        
        if(dayOfWeek == 'Friday'){
            dateToBeChanged = system.Today().addDays(3);
        }
        else if(dayOfWeek == 'Saturday'){
            dateToBeChanged = system.Today().addDays(2);
        }
        List<Task> listOfTaskToUpdate = new List<Task>();
        for(Task tsk : [Select ActivityDate from Task where IsClosed = false AND OwnerID =:selectedUserId]){
            if(tsk.ActivityDate <= system.today()){
                tsk.ActivityDate = Date.valueOf(dateToBeChanged);
                listOfTaskToUpdate.add(tsk);
            }
        }
        
        if(listOfTaskToUpdate.size() > 0){
            update listOfTaskToUpdate;
        }
        return null;
    }
    
    public PageReference cancelChanges() {
        return null;
    }
    
    public PageReference saveChanges() {
        Set<Id> conIds = new Set<Id>();
        Set<Contact> setOfContacts = new Set<Contact>();
        List<Contact> listOfContactToUpdate = new List<Contact>();
        
        for(Task tsk : taskList){
            if(tsk.Dummy_Contact__c != null){
                conIds.add(tsk.Dummy_Contact__c);
            }
        }
        for(Contact con : [Select Name,Title, Key_Exec__c, Exec_Type__c, Direct_Dial__c, MobilePhone, Phone, MailingState, Timezone__c, Attendee_Contact__c, Task_Attendee__c from Contact where id in :conIds]){
            for(Task tsk : taskList){
                if(tsk.Dummy_Contact__c == con.id){
                    con.Title = tsk.Dummy_Contact__r.Title;
                    con.Key_Exec__c = tsk.Dummy_Contact__r.Key_Exec__c;
                    con.Exec_Type__c = tsk.Dummy_Contact__r.Exec_Type__c;
                    con.Direct_Dial__c = tsk.Dummy_Contact__r.Direct_Dial__c;
                    con.MobilePhone = tsk.Dummy_Contact__r.MobilePhone;
                    con.Phone = tsk.Dummy_Contact__r.Phone;
                    con.MailingState = tsk.Dummy_Contact__r.MailingState;
                    con.Timezone__c = tsk.Dummy_Contact__r.Timezone__c;
                    setOfContacts.add(con);
                }
            }
        }
        if(setOfContacts.size() > 0){
            listOfContactToUpdate.addAll(setOfContacts);
            update listOfContactToUpdate;
        }
        
        if(taskList.size() > 0){
            update taskList;
        }
        return null;
    }
    public PageReference setCurrentUser() {
        populateSelectOptions();
        populateTaskData();
        return null;
    }
}
I have a custom object, Task Helper, with two fields, "Next Step" Data Type = Long Text Area and "Related Meeting" Data Type = Lookup(Task Helper). The field "Next Step" has been added to Custom VF page, a Task.
 
My problem is running a report that can pull in Activity fields and the "Next Step" field.
 
I've tried CRT to no avail.
 
Any ideas? I asked Steve Molis and he said I lost him at Visualforce.
I'm trying to update the Task Helper record with the Related Event ID and keep getting this error.

Any help would be appreciated.
Thank you,

trigger UpdatedRelatedEventField on Task_Helper__c (before insert, before update) {
    for(Task Helper record: Trigger.new) {
        try {
            record.Related_Event__c = Id.valueOf(record.Related_Event__c);
        } catch(Exception e) {
            
        }
    }
}
I need the fields "Meeting Rating" and "Rating Notes" to be Read Only on this page only. I know how to do it with FLS, but not for a vf page.

Also, once the 'Post-Meeting Notes' task has been created and saved, if you you edit it, it shows a different page layout; (Pre-Meeting Notes layout).

<apex:page standardController="Task" extensions="ViewTaskExtension">
    <apex:sectionHeader title="Task" subtitle="{!Task.Subject}" />
    <apex:form >
        <apex:pageMessages ></apex:pageMessages>
        <apex:pageBlock title="Task Edit"  id="thePageBlock" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" value="Edit"/>
                <apex:commandButton action="{!delete}" value="Delete"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Task Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.OwnerId}"/>
                <apex:outputField value="{!Task.Attendee__c}"/>
                <apex:outputField value="{!Task.Subject}"/>
                <apex:outputField value="{!Task.WhatId}"/>
                <apex:outputField value="{!Task.ActivityDate}"/>
                <apex:outputField value="{!Task.WhoId}"/>
                <apex:outputField value="{!Task.Description}"/>
                <apex:outputField value="{!taskHelper.Next_Steps__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputfield value="{!Task.Meeting_Rating__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputfield value="{!Task.Rating_Notes__c}" rendered="{!showPostTaskFields}"/>
                <apex:outputField value="{!Task.Date_Approved__c}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Approved_by__c}" rendered="{!showPreTaskFields}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Additional Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.Priority}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Meeting_Notes__c}" rendered="{!showPreTaskFields}"/>
                <apex:outputField value="{!Task.Status}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="System Information" columns="2" collapsible="false">
                <apex:outputField value="{!Task.CreatedById}"/>
                <apex:outputField value="{!Task.LastModifiedById}"/>
                <apex:outputField value="{!Task.Related_Event__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller
public with sharing class CreatePostMeetingTaskExtension {
    
    private Event currentEvent;
    public Task postMeetingTask {get;set;}
    public Task_Helper__c taskHelper {get;set;}
    public CreatePostMeetingTaskExtension(ApexPages.StandardController controller) {
        this.currentEvent = (Event)controller.getRecord();
        currentEvent = [Select OwnerId,Attendee__c,WhatId,WhoId,Meeting_Rating__c,Rating_Notes__c from Event where Id =: currentEvent.id];
        
        taskHelper = new Task_Helper__c();
        
        postMeetingTask = new Task();
        postMeetingTask.OwnerId = currentEvent.OwnerId;
        postMeetingTask.Attendee__c = currentEvent.Attendee__c;
        postMeetingTask.WhatId = currentEvent.WhatId;
        postMeetingTask.WhoId = currentEvent.WhoId;
        postMeetingTask.Meeting_Rating__c = currentEvent.Meeting_Rating__c;
        postMeetingTask.Rating_Notes__c = currentEvent.Rating_Notes__c;
        postMeetingTask.Subject = 'Post Meeting Notes';
        postMeetingTask.Status = 'Completed';
        postMeetingTask.Related_Event__c = currentEvent.id;
    }
    public PageReference save(){
        insert taskHelper;
        postMeetingTask.Task_Helper__c = taskHelper.id;
        insert postMeetingTask;
        return new PageReference('/'+postMeetingTask.id);
    }
}

Is there any possible way I can create a Text Area (Long) field type for an Activity Task? I don't see any option for this when creating a custom field. I need it badly.

 

There seems to be a lot of random limitations when working with Activity Tasks and Events which is very frustrating.