web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Permission denied error on reloading the Parent page from child page in crm 2011

(0) ShareShare
ReportReport
Posted on by 35

Hi All,

I am trying to reload the Parent page from child page on save.  I am using the below code to refresh it.

window.parent.opener.location.reload(true);

This code is working fine for the first time I save the child record. But if i am staying on the same child page and modified something on the page then saving the record. now i am getting the error as Permission denied.

This error is coming because, in the code "window.parent.opener.location.reload(true)" is not able to find location value.

the location value is coming as {...}.

Any help is appreciable.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nizar JLASSI Profile Picture
    2 on at

    Hi Ashok,

    Try to get parent window in the OnLoad Event of the child. And store it in the Cache of your navigator with a unique name. To do it use JQuery.

    And when you try to save your child form, if you find directly your window parent you can use this window.parent.opener.location.reload(true) otherwise you retrieve your object using the same name from Cache.

    This is the code :

    1. var localCache = {
    2.     data: {},
    3.     remove: function (objName) {
    4.         delete localCache.data[objName];
    5.     },
    6.     exist: function (objName) {
    7.         return localCache.data.hasOwnProperty(objName) && localCache.data[objName] !== null;
    8.     },
    9.     get: function (objName) {
    10.         return localCache.data[objName];
    11.     },
    12.     set: function (objName, cachedData) {
    13.         localCache.remove(objName);
    14.         localCache.data[objName] = cachedData;
    15.     }
    16. };
    17.  
    18. $.ready(function (e) {
    19.     var parentWindow = window.parent.opener;
    20.     var parentWindowName = 'parentWindow_' + Xrm.Page.data.entity.getId();
    21.     localCache.set(parentWindowName, parentWindow);
    22.  
    23. });
    24.  
    25. function reloadParentWindow() {
    26.     var parentWindowName = 'parentWindow_' + Xrm.Page.data.entity.getId();
    27.     var parentWindow;
    28.     if (window.parent.opener != null && window.parent.opener !== undefined) {
    29.         parentWindow = window.parent.opener;
    30.     }
    31.     else {
    32.         var parentWindow = localCache.get(parentWindowName);
    33.     }
    34.     parentWindow.location.reload(true);
    35.     localCache.remove(parentWindowName);
    36.     window.close();
    37. }
    I hope that it can help you.
    Nizar JLASSI
    Dymamics CRM Trainer and Senior Consultant
    Email : n.jlassi@gmail.com

    4TOCOPWZQ6TL.jpg  4TOCOSXBT5KL.jpg  4TOOJYT41KG6.jpg  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans