Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Does GridAttribute really support the controls collection?

Posted on by 1,010

Developers Guide says, "GridAttribute also supports the controls collection for attributes of a selected grid row, which provides methods to work with a collection of cells associated with the attribute. Each cell (GridCell) of a selected grid row is analogous to a control on a form that is tied to an attribute in an editable grid."

So, can I use Control.addCustomView() to a lookup cell?  Specifically, the editable OpportunityProduct grid on the Opportunity form at the Existing Product(productid) cell?

Can anyone conjure up the syntax?  I'm not clear on how to get a GridAttribute or GridCell from a grid not yet containing records.  Trying to avoid using the unsupported, DOM hacking solution I found.

Thanks,

-md

*This post is locked for comments

  • Martin Donnelly Profile Picture
    Martin Donnelly 1,010 on at
    RE: Does GridAttribute really support the controls collection?

    I'm about to give this a try.  Sorry for the delay.  As far as the article in the link goes, my challenge is that I need to filter OR or IN as I am looking for product in either of two lists and this only filters related on one.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Does GridAttribute really support the controls collection?

    Hi,

    Based on the description it does look like it will work. Ypou can try this yourself and see how you go. I haven't tried this yet but the it should be something like below

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

    var formContext = executionContext.getFormContext(); // get the form Context

    var gridContext = formContext.getControl("Contacts"); // get the grid context

    var allSelectedRows = gridContext.getGrid().getSelectedRows();

    allSelectedRows.forEach(function (row, i) {

    var gridCellControl = row.GridCell.addCustomView(viewId, entName, vwName, resFetch, resLayout, true);

    }

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

    Also, I would suggest you to read the below article as well which talks about setting the specific view to the lookup and also filter it by related records within the subgrid.

    community.dynamics.com/.../filtered-lookups-in-editable-grids-for-dynamics-365

    Hope this helps.

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,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