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

Community site session details

Session Id :
Customer Service forum

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

(0) ShareShare
ReportReport
Posted on by 47

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:
I have the same question (0)
  • Suggested answer
    Wouter Madou Profile Picture
    3,392 on at
    RE: When I create a new record from the new record form, it loses the relationship with the main entity

    This is by design since you are starting from the registration entity and no longer from the catalog entity, hence you do not have a relationship towards to original parent record.

    You will be better of to press save and close and create a new one from within the still open catalog record.

  • neryhumberto Profile Picture
    47 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?

  • Wouter Madou Profile Picture
    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.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator 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.

  • neryhumberto Profile Picture
    47 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

  • RaviKashyap Profile Picture
    55,410 Moderator 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.

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator 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.

  • neryhumberto Profile Picture
    47 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
    55,410 Moderator 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
    47 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.

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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans