+ Start a Discussion

Home Page Component (Javascript) - List views, related list hover links not Loaded.

Hi All,


I have included a homepage component with Javascript to have dynamic manipulation of few fields of an object. Below is the script. But after inclusion of this component in the home page layout, related-list hover links are not getting loaded. Also none of the list views displays anything. The list views shows 'loading..' in the left bottom of its frame and its struck there. Does my code have anything that stops sfdc features to work as expected.



<br> <script>
function callMeNow(){

    var contactNotFound =parent.document.getElementById('00NP0000000XXXX');
    var contactNotFoundDetail =parent.document.getElementById('00NP0000000XXXX_ilecell');
    if(contactNotFound != null){
        contactNotFound.outerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";
    if(contactNotFoundDetail != null){
        contactNotFoundDetail.innerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";

    return true;

    if((window.parent.location.href.indexOf("/a0F")>0 || window.parent.location.href.indexOf("%2Fa0F")>0)){
    return true;



The problem was with window.onload event handling. If i remove window.onload, list views and related list hover links works fine..but my functionality requires window.onload as only then I will be able to manipulate the fields i.e, after they are rendered..

var oldonload = window.onload;

window.onload = function()
        // check if an onload already exists

//your onload code here...

I thought handling oldOnLoad might work. But it didnt. 


var oldOnLoad = window.onload;



this alert always displayed 'undefined'.


finally i end up having the below code to execute the sfdcPage bodyOnLoad statement from my onLoad method:


window.onload = function(){


if (typeof(startSessionTimer)!='undefined') {startSessionTimer(); };

if (typeof(ActivityReminder)!='undefined') {ActivityReminder.initialize([], false, false);};

if ((window.sfdcPage) && (sfdcPage.executeOnloadQueue)){sfdcPage.executeOnloadQueue();}; Cookies.prototype.DeleteCookie('setupopen');

new SidebarSearchAutoCompleteElement("sbstr","/_ui/common/search/client/ui/SidebarSearchAutoCompleteServlet",1,{},true,"sen","sbsearch");  if (window.Jiffy && Jiffy.onLoad) Jiffy.onLoad(); if (window.Jiffy && window.Jiffy.ui && Jiffy.ui.onLoad) Jiffy.ui.onLoad(); 



and yes this worked well...


But still I want to know why oldOnLoad did not work and is there any issues in explicitly calling methods like startSessionTimer(), executeOnloadQueue();