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)

Alternative to window.top.opener after moving from CRM 2011 to CRM 2013

(0) ShareShare
ReportReport
Posted on by

In Dynamics 2011  forms came on as a popup, but in Dynamics CRM 2013, most forms are loaded within the page. So the usage of window.opener is not working in JavaScript. Is there an alternative to get the attributes of a parent form???

Previously we got data this way(Dynamics CRM 2013).. 

if (window.top.opener)
{
try
{
 var parentXrm = window.top.opener.parent.Xrm; //Find parent Xrm
 if (parentXrm && parentXrm.Page && parentXrm.Page.data && parentXrm.Page.data.entity &&   parentXrm.Page.data.entity.getEntityName() == Entities.Opportunity.LogicalName)
{
.
.
.
.
}
} }


 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rajkumar Rajaraman Profile Picture
    on at

    Hi Sameen,

    Take a look to the following links:

    www.magnetismsolutions.com/.../access-microsoft-dynamics-crm-quick-view-form-attributes-using-javascript

    msdynamicscrmblog.wordpress.com/.../javascript-references-in-microsoft-dynamics-crm-2013

    Hope this helps.

    Regards,

    R.Rajkumar

    "Please mark my answer as verified if you found it helpful"

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    You can write a service call to get parent entity information for child entity.

  • Community Member Profile Picture
    on at

    Could you provide links on how I can do that? Thanks!

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Child entity will contain lookup for parent record, so you could get that parent entity record id and can use REST retrieve method to get details for parent entity basedon parent id.

    You can look for this sample where you can pass your parent entity id and get your field from result set. Make sure to change entity name with your entity schema name

    mahenderpal.wordpress.com/.../get-parent-customer-id-based-on-contact-id

    Thanks

  • mscrmba Profile Picture
    on at

    What is the business requirement you're trying to meet?

    If you're just needing to show the data then I'd go with Raj's suggestion and use a Quick View Form.  They're really easy to make and are a fully supported solution.

    You shouldn't need Jscript if you're just wanting to display data that is on the parent form.

    Explaining / demonstrating what they can be used for:

    blog.customereffective.com/.../crm-2013-quickstart-excerpt-dynamics-crm-quick-view-forms.html

    The step by step instructions:

    technet.microsoft.com/.../dn531126.aspx

    Quick view forms are forms that can be "nested" onto other forms.  For example the opportunity form can have a quick view of the account record - including key account information and the list of active contacts and opportunities for that account.  CRM systems have always tried to provide a "360 degree view" of the customer.  Quick view forms make that view visible without having to navigate to 3 different forms to see it.

  • Waqar Sohail Profile Picture
    on at

    have you tried window.parent.opener?

  • Community Member Profile Picture
    on at

    I guess I needed to explain more, I apologize for that. I'm trying to change the javascript function which is already implemented in the system(for each entity). I want to make a simple changes, without having to rewrite the whole code and make changes across the system, for the entities.

    The job of the function is to automatically populates salesreps and commissions only if parent is Opportunity and Lock Values is not true. This should populate values for both new Orders and updating Orders as long as opened from the parent Opportunity. This is still part of the function that I want to change. All this is triggered during form load.

    if (window.top.opener)
    {
    try
    {
    var parentXrm = window.top.opener.parent.Xrm; //Find parent Xrm
    if (parentXrm && parentXrm.Page && parentXrm.Page.data && parentXrm.Page.data.entity && parentXrm.Page.data.entity.getEntityName() == Entities.Opportunity.LogicalName)
    {
    if (Entities.New_vssorder.New_LockSalesReps.getValue() != true)
    {
    doing something;
    }
    }
    }
    }

  • Community Member Profile Picture
    on at

    That's what I want to remove, since window.parent.opener doesn't exactly work in Dynamics CRM 2013, although it did in Dynamics 2011.

  • Waqar Sohail Profile Picture
    on at

    it work in CRM 2013. have you tried?

  • Community Member Profile Picture
    on at

    Thank You Waqar it does work. But the problem is that in some instances, instead of a new window, the form is redirected in the current window. Then window.parent.opener does not exist. If I could always open the forms in a new window, there wouldn't be any problems (as was the case in Dynamics 2011).

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