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
Inanskar007Inanskar007 

how to hide save and send update button

Hi
I want to hide save and send update button in Event edit page. In Salesforce , these save and hide button will be visible only when u add invitees more than 1 user.

I have tried to create a custom visualforce page similar to Event edit page but i'm not not able to add the related list Attachments and Invite Other details
The following is my code

VF page:

<apex:page standardController="Event" extensions="CustomVisitController" showHeader="true">
  <apex:form >
  <apex:pageBlock title="Calendar">
  <apex:pageBlockButtons >
  <apex:commandButton action="{!Save}" value="Save"/>
  <apex:commandButton action="{!saveAndNewTodo}" value="Save & New To do"/>
  <apex:commandButton action="{!saveAndNewVisit}" value="Save & New Visit"/>
  <apex:commandButton action="{!cancel}" value="Cancel"/>
  </apex:pageBlockButtons>
  <apex:pageBlockSection title="Visit Details (Only create visits from a Contact)" columns="4">
   <apex:inputField value="{!Event.Ownerid}">
  <apex:actionSupport event="onchange" rerender="Event_view" action="{!rerender}">
  <apex:param name="ownerId_VF" value="{!Event.Ownerid}" assignTo="{!ownerId_VF}" />                    
  </apex:actionSupport>
  </apex:inputField>
  <apex:inputField value="{!Event.Type}" />
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:inputField value="{!Event.Subject}"/>
  <apex:inputField value="{!Event.StartDateTime}">
  <apex:actionSupport event="onchange" rerender="Event_view" action="{!rerender}">
  <apex:param name="startDate_VF" value="{!Event.StartDateTime}" assignTo="{!startDate_VF}"/>
  </apex:actionSupport>
  </apex:inputField>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:inputField value="{!Event.Whoid}"/> <!--<apex:commandLink value="[Add to Invitees]"/> -->
  <apex:inputField value="{!Event.EndDateTime}"/>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:inputField value="{!Event.Whatid}"/>
  <apex:inputField value="{!Event.IsAllDayEvent}"/>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  <apex:inputField value="{!Event.Location}"/>
  </apex:pageBlockSection>
  <apex:pageBlockSection title="Visit Notes - Use Description field for visit, and follow-up notes">
  <apex:inputField value="{!Event.Description}"/>
  <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
  </apex:pageBlockSection>
  <apex:pageBlockSection title="Recurrence">
  <apex:inputField value="{!Event.IsRecurrence}"/>
  </apex:pageBlockSection>
   <apex:pageBlockSection title="Reminder">
  <apex:inputField value="{!Event.IsReminderSet}"/>
  </apex:pageBlockSection>
  <apex:pageBlockSection >
 
 
  </apex:pageBlockSection>
 
 
  </apex:pageBlock>
 
   <apex:pageBlock title="Attachments">
  <apex:commandButton value="Attach File" action="{!attachfile}"/>
  </apex:pageBlock>
  </apex:form>

 
</apex:page>

Controller

public with sharing class CustomVisitController {

    public CustomVisitController(ApexPages.StandardController controller) {
       
    }
    
    Public PageReference rerender() {
    
    return null;
    }
    
    Public PageReference saveAndNewTodo() {
     try{
            Event eve = new Event();
             upsert eve;
        }        
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Error creating/updating record'));
        }
        PageReference pageRef = new PageReference('https://cs11.salesforce.com/00T/e?retURL=%2Fhome%2Fhome.jsp');
        pageRef.setRedirect(true);

        return pageRef;   
    
    }

     Public PageReference saveAndNewVisit() {
     try{
            Event eve = new Event();
             upsert eve;
        }        
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Error creating/updating record'));
        }
        PageReference pageRef = new PageReference('https://c.cs11.visual.force.com/apex/CustomVisitPage');
        pageRef.setRedirect(true);

        return pageRef;   
    
    }
Public PageReference attachfile(){

Attachment a = new Attachment();
upsert a;
return null;

}


}

Please guide let us know how to go further. Thanks
SonamSonam (Salesforce Developers) 
Did some investigation on this and found that "Add Invitees" feature cannot be added to the visualforce page you have created.