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
SachiiSachii 

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;
}

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

</script>

SachiiSachii

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..

iamshaamiamshaam
var oldonload = window.onload;

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

//your onload code here...
}
SachiiSachii

I thought handling oldOnLoad might work. But it didnt. 

 

var oldOnLoad = window.onload;

alert(oldOnLoad);

 

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(){

setFocusOnLoad();

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();