Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / subgrid not showing re...
Sales forum

subgrid not showing records

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

i have triggered plugin on create and update of opportunity, it works fine when i debug but the created records are not showing on the subgrid of opportunity.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: subgrid not showing records

    thank you for your ans. this works well.

    i have plugin for update but don't know how to give id to update. my code is

    if (retrievedEntity.Entities.Count > 0)

                                                 {

                                                         for (int i = 1; i < weeknumber.Length; i++)

                                                     {

                                                             Entity newentity = new Entity("test_resourcefulfilment");

                                                             entity.id=????

                                                             newentity["test_weeknumber"] = weeknumber[i].ToString();

                                                             newentity["test_hours"] = hours[i];

                                                             service.Update(newentity);

                                                     }

                                                 }

  • Suggested answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: subgrid not showing records

    Its the name I have  assumed you have used to add a lookup field on the test_resourcefulfilment entity that references the opportunity entity where you want these records to appear.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: subgrid not showing records

    what is the type of attribute "test_opporutinity"?

  • Verified answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: subgrid not showing records

    Yes you do need to add an entityreference to the opportunity as otherwise the system doesn't know what those newly created records relate to.

    new_entity["test_opportunity"]=new EntityReference(entity.logicalname, entity.Id);

    should do it.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: subgrid not showing records

    I want to split the date into week wise and stores the hours weekwise , so i have one entity which stores the week wise data of opportunity using plugin.

    I want to show in the subgrid which is related to only that opportunity , but it is showing all records  

    this is my code, can  I use entity refrence to map the fields because it is not showing related records in subgrid?

    for (int i = 1; i < weeknumber.Length; i++)

                           {

                               Entity newentity = new Entity("test_resourcefulfilment");

                               newentity["test_name"] = entity.Attributes["name"];

                               newentity["test_weeknumber"] = weeknumber[i].ToString();

                               newentity["test_hours"] = hours[i];

                               service.Create(newentity);

                           }

  • Suggested answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: subgrid not showing records

    It's worth emphasising that the front end interfaces of Dynamics 365 are separate to the back end systems and the front end refreshes have become far more specific / granular over the years - the front end will now only refresh grids it is told it needs to refresh.

    Having said the above, I assume your plugin is creating a child record(s) that need to appear on the subgrid once the record is saved. If that is the case (and assuming that the plugin is running synchronously) you will need to trigger a refresh of the subgrid when the records completes saving for the new record to be visible.

    Now the code to get the gridcontext and to refresh the grid is (I'm assuming you are using version 9 and above):

    function doSomething(executionContext) {
       var formContext = executionContext.getFormContext(); // get the form Context
       var gridContext = formContext.getControl("Contacts"); // get the grid context
       gridContext.refresh();
       // Perform operations on the subgrid
    }


    You will need to trigger than sometime after the record is saved (probably be putting it in a timeout function with a 5-10 second delay within an onsave javascript event).

  • Johnny Gong Profile Picture
    Johnny Gong 6,482 on at
    RE: subgrid not showing records

    Hi,

    It seems that your plugin doesn't finish its job. You could go to solution explorer to check the Process Sessions' status. If it is not succeed you could use Plugin Profile to debug your plugin step by step. You could refer to the following thread linkage for more debugging process details.

    https://community.dynamics.com/365/sales/f/762/t/285612 

    666.png

    Related video : https://www.youtube.com/watch?v=zTM2l-J6opk

    Hope it would help.

    Regards

    Johnnyg

  • diegompc Profile Picture
    diegompc 798 on at
    RE: subgrid not showing records

    Hi Srishti!!

    Can you give us more details about your question? What kind of records are created? What view are you using in subgrid?

    Regards!!

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... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans