Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Copying records from one entity to a subgrid in another entity

Posted on by 240

Hello, 

I have an entity A with three fields. I have created records in entity A which contain these fixed fields. I want these records to be default and reflect in a subgrid of entity B, whenever the form loads. That subgrid contains several fields, and three of these fields are the same ones in entity A. 

So the records in entity A need to show as default in the subgrid, and the other fields in the subgrid can remain empty and will be worked on manually by the user. 

What are the ways to do this?

Would appreciate the help. 


Thank you. 

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Copying records from one entity to a subgrid in another entity

    Hi Aneeqa,

    Thanks for your answer, according your detailed description, you can achieve your goal through following steps.

    1.create three calculated field (Action, Category, Recommendation) on the AI Entity form.

    Take category as an example, for Action and recommendation, you can repeat it.

    pastedimage1597401800251v1.pngpastedimage1597401809297v2.png

    2.create 1:N relationship between Host and AI entity, and add lookup field(host) to AI entity form.

    pastedimage1597401903920v5.png

    3.create a custom view that include fields of table (Action, Category, Recommendation, Client, Modified By, Status) on AI entity.

    pastedimage1597401838171v3.png

    4.insert a sub-grid to the plan form of Host entity and set custom view that just created as  default view of the sub-grid.

    pastedimage1597401922806v6.png

    5.clcik the Controls Tab to add Editable Grid, so that you can edit sub-grid on the plan form.

    pastedimage1597401931757v7.png

    6.Test.

    (1) On AI Default form, there is an record as following. and on AI entity form, fill host and DefAI lookup field, Three fields(Action, Category, Recommendation) will be filled with records from AI Default entity automatically after you save the record.

    pastedimage1597401963789v8.pngpastedimage1597401975749v9.png

    (2) On the host entity, open one record(test host) that you just select in host lookup field.

    pastedimage1597402059014v11.png

    For question that you mentioned: “The DefAI was a drop-down option set kind of thing which was only for the field (Actions) from AI Default entity

    You can’t include three fields in one lookup field. In fact, the lookup fields store the ID of the AI Default record.

    However, you can show three fields on the view of the drop-down box by adding columns to AI Default lookup view. Just like following pictures show:

    pastedimage1597402256215v12.png

    Click pastedimage1597402262531v13.png andpastedimage1597402272002v14.png button to expand record, you will see action, recommendation and category.

     pastedimage1597402296980v16.png

    Regards,

    Leah Ju

  • Suggested answer
    Roma Gupta Profile Picture
    Roma Gupta 725 on at
    RE: Copying records from one entity to a subgrid in another entity

    Hi Aneeqa

    Based on discussion so far, I would suggest to write a JavaScript to fetch data & get it on the records of subgrid.

    Regards

    Roma

  • Aneeqa Pervaiz Profile Picture
    Aneeqa Pervaiz 240 on at
    RE: Copying records from one entity to a subgrid in another entity

    Hello Leah,

    1. There are three entities in play here.

    AI Default entity

    AI entity

    Host entity

    At the moment, there is a subgrid of AI entity on the form of Host entity.

    2. The Plan form was the main form of the Host entity - this contains the subgrid of AI entity.

    3. So the AI Default entity contains only three fields - Action, Category, Recommendation. These three same-name fields are also in the subgrid of AI entity which is shown on the Plan form.

    What I am looking for is to have these three fields on Plan form be populated by default with the records of AI Default entity. So the final result would be something like this.

    2020_2D00_08_2D00_13-07_5F00_32_5F00_20_2D00_Document1-_2D00_-Word.png

    The three fields would be filled in, and the rest of the columns would be empty for the user to work on.

    What would be the ways to do this. 

    Thank you. 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Copying records from one entity to a subgrid in another entity

    Hi Aneeqa,

    In order to clarify your needs, please help me answer following three questions.

    1." I want these records to be default and reflect in a subgrid of entity B, whenever the form loads."

    The sub-grid is entity of entity B? Or it is on the entity B form?

    2.” The existing entity AI has a quick view - which is added to a form, I will call that a Plan Form.

    what is the quick view you mentioned? Quick view form of AI or quick view form of AI Default?

    3.” This entity contains three fields - Action, Recommendation, and Category.

    Three fields are just for AI Default entity? Or AI entity also has the same fields?

    Whatever the situation, they will be populated only when lookup field was filled.

    Regards,

    Leah Ju

  • Aneeqa Pervaiz Profile Picture
    Aneeqa Pervaiz 240 on at
    RE: Copying records from one entity to a subgrid in another entity

    Hello,

    Rakesh, Thank you for the first step here. Here is what I have so far.

    I have an entity called AI.

    I created an entity called AI Default. This entity contains three fields - Action, Recommendation, and Category.

    The existing entity AI has a quick view - which is added to a form, I will call that a Plan Form. So the quick view has a lot of columns, out of which three columns are Action, Recommendation and Category.

    Now, what I am aiming for is to store a set number of records in my AI Default entity. And I want this entity to be linked to the existing AI entity - so that the quickview is always populated with the set records I have stored in my default AI entity. Whenever the form 'Plan Form' loads, I want the quickview to be pre-populated with the records from AI Default, so only the three columns (Action, Recommendation, and Category) would be populated, and the rest of the columns would be empty for the user to work on.

    What I did was create a 1:N relationship between AI Default and AI. A lookup field (DefAI) was created in AI, I added that to the view, but there were problems with this:

    1. It was not pre-populated.

    2. The DefAI was a drop-down option set kind of thing which was only for the field (Actions) from AI Default entity. How do I include three fields in one lookup? And how do I get them to pre-populate when the 'Plan Form' loads.

    Please help out.

    Thank you.

  • Suggested answer
    RakeshJ Profile Picture
    RakeshJ on at
    RE: Copying records from one entity to a subgrid in another entity

    Hi Aneeqa,

    If I understand your scenario correctly you have - Entity A and Entity B

    Entity A contains three fields. Lets say - Name, Email Address, Phone Number.

    You want Entity A records to reflect in EntityB (in a subgrid) and those three field values from EntityA to show up in the subgrid.

    If this is the ask - then it can be easily achieved by creating 1:N relationship between Entity A and Entity B. Refer article for more details https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-and-edit-1n-relationships

    It will create a lookup field which you have to add on EntityA form.

    In my lab -

    I have Entity A (Account entity) and Entity B (TestEntity)

    I created 1:N relationship from Account to TestEntity and I have below fields. TestAcc is the field created from the 1:N relationship.

    pastedimage1596901822911v1.png

    On Account form, I have a subgrid of TestEntity which shows the field values. You can add/remove fields from the view if you want. https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/choose-and-configure-columns

    pastedimage1596901966580v2.png

    Regards,

    Rakesh


    If this is helpful, kindly mark this as verified. 

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans