0

I want to remove the buttons in image below from the event detail page.

Calander Buttons

I was able to find a Jquery based solution which works when I put it in a custom button and click on it it hides the button.

{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js')}
$("div").remove(".calendarHeaderBG, .calendarHeader");

I want this to happen automatically thus when I use the same in an Inline VF Page it doesnt hide the buttons.

Here is the Inline VF Page Code

<apex:page standardController="Event" >
    <script src="ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script>
        alert('Check 1');
        $("div").remove(".calendarHeaderBG, .calendarHeader");
        alert('Check 2');
    </script>
</apex:page>

Here alert "Check 2" is not firing which means somewhere JS is failing.

Any help will be highly appreciated.

Thank You.

1

I would offer you to use apex:detail as your solution.Below is the code example

<apex:page standardController="Event">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    ReadyFunc();
});
function ReadyFunc(){
    var a = $('[value$=pections]').first().attr('onclick');
    $('[value$=pections]').first().attr('onclick','ShowPopup();'+a);
}

<apex:detail relatedList="true" inlineEdit="true" relatedListHover="true" oncomplete="ReadyFunc();"/>
</apex:page>

You can do anything you want inside ypur document ready function automatically.

more information about : apex:detail

SOLUTION: apex:detail for event object doesnt display these buttons thus no JS needed at all, just replace standard page with apex:detail of a VF Page

5
  • With this you want me to override the standard page but I'm looking for an option where I insert an "Inline VF Page". This inline VF page contains the JS code which should load when the page loads and eventually hiding the buttons. No user interaction. – Nishant Singh Panwar Dec 6 '16 at 13:16
  • Salesforce does not allow you to reach parent page from iframe for security reasons since your clickJack setting not enabled for your organization. I think, it's not possible to do it automatically from inline vf page w/o clickjack enabled. – umithuckan Dec 6 '16 at 13:29
  • Is there a way to enable clickjack or any other way to run this JS automatically when page loads. – Nishant Singh Panwar Dec 6 '16 at 13:49
  • To enable clickjack protection for Visualforce pages that suppress the standard header, select Enable clickjack protection for customer Visualforce pages with headers disabled under Setup | Security Controls | Session Settings. But you will see that checkbox as disabled.You need to open a case to salesforce to be able to enable that. releasenotes.docs.salesforce.com/en-us/summer15/release-notes/… – umithuckan Dec 6 '16 at 14:04
  • Thank You for the great information @umithuckan. Also I added a custom VF page for event adding the detail component and found that the buttons doesn't appear without adding any JS, must be due to the fact that these buttons are specially added by salesforce and are not present with apex:detail – Nishant Singh Panwar Dec 6 '16 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.