Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

When I create a new record from the new record form, it loses the relationship with the main entity

Posted on by 45

Hi 

This only happen when I click on New in the other form.

Does somebody can help me?

8688.png

84216.png

3v2.png

Categories:
  • neryhumberto Profile Picture
    neryhumberto 45 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    I Ravi, I sent you a message,

  • neryhumberto Profile Picture
    neryhumberto 45 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Hi Ravi, it works! again thank you so much.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    UYou need to update the schema name of your parent entity in place of "account".

  • neryhumberto Profile Picture
    neryhumberto 45 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Hi Ravi,

    This shows me "LOOKUP CONTROL ERROR: Cannot add item of typename= to the lookup control"

    I did something wrong?

    https://youtu.be/6PU_yQikL4c

    Thanks a lot.!

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Use the below code.

    You need to register this method on load. You also need to replace the field schema values.

    =============

    function loadParentDetailsToChild() {    

       try {

           var parentAccountId = parent.top.opener.Xrm.Page.data.entity.getId();

           var parentAccountName = parent.top.opener.Xrm.Page.getAttribute("name").getValue();

           var parentAccountLookup = new Array();

           parentAccountLookup[0] = new Object();

           parentAccountLookup[0].id = parentAccountId;

           parentAccountLookup[0].name = parentAccountName;

           parentAccountLookup[0].entityType = "account";

           Xrm.Page.getAttribute("parentcustomerid").setValue(parentAccountLookup);

       }

       catch (err) {

           console.log(err.message);

       }

    }

    ==========================

    Hope this helps.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    That is not correct. You have copy pasted the statement I have shared whereas you need to use that statment in your code. Basically you need to create a method and there you need to add that statement. Once done, you need to register that method on the load.

    Refer this for JS basics:  neilparkhurst.com/.../

    I will get back to you with the updated code.

  • neryhumberto Profile Picture
    neryhumberto 45 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Hi Ravi,

    Do you know what I am doing wrong?

    https://youtu.be/ZMvZkOeTcnE

    Thanks a lot

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Hi,

    You could get the value from parent using the below unsupported javascript-

    parent.top.opener.Xrm.Page.getAttribute("name").getValue()

    Hope this helps.

  • Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Unfortunately not that I know of.

    Maybe a technical solution with a custom button that copies over certain fields but I can't help you with that.

    On the other side as a functional solution I would propose to change this to or an editable grid or a quick create form for a more rapid approach in creating records.

  • neryhumberto Profile Picture
    neryhumberto 45 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    Any other solution?

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans