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 Answer 1

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. Commented Dec 6, 2016 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
    Commented Dec 6, 2016 at 13:29
  • Is there a way to enable clickjack or any other way to run this JS automatically when page loads. Commented Dec 6, 2016 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
    Commented Dec 6, 2016 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 Commented Dec 6, 2016 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .