Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Editable Subgrid Quagmire

  • 1.  Editable Subgrid Quagmire

    Posted Dec 13, 2019 04:49 PM
    Edited by Joseph Thiel Dec 16, 2019 11:20 AM
    I have an editable grid for the Opportunity Products in Opportunities in our on-premise D365, but the wrong columns are editable.  I've been trying to correct this through Javascript--which every website I can find recommends as the solution--but none of my attempts have worked.  I've spent a couple workdays trying to get this working, so any help you can offer would be greatly appreciated.

    1)  When I go to edit the properties of the opportunityproductsGrid on our Opportunity form, under the Controls tab, I can see that an editable grid is attached named "Opportunity Product Inline Edit View".  Since we had a third party set up D365 for us, I had assumed until now that they had built this for us.  But isn't this view an OOTB view?  Doesn't that mean it was also editable OOTB?

    2) In the grid properties, under the Controls tab, all three radio buttons (Web, Phone and Tablet) are still set to "Read-only Grid (default)".  What do these radio buttons control?

    3) We'd love to use a custom view here instead of Opportunity Products Inline Edit View, but we use bundles, and we need the ability to click on the folder(?) icon on the left and show/hide the products in the bundle.  We discovered that feature breaks if we substitute a custom view.  Is that still true, or has someone patched or figured out away around that problem?

    4) As I'm sure you already know, the Opportunity Products Inline Edit View can't be edited.  What I really need to do, though, is change which columns are editable or not.  Every website I can find recommends using Javascript to enable and disable the fields in the subgrid, and that's what I've been pulling my hair out trying to do these past couple days.  Can it be done on this particular view, or does the fact that it can't be edited also prevent it from being customized via Javascript?

    5) I first tried writing a Javascript function (with a simple Alert box) in our Opportunity script that would run OnRecordSelect (by attaching the function to the appropriate Event in the aforementioned opportunityproductsGrid).  It never ran.  Is that because none of the 3 radio buttons have the editable grid selected?

    6) I guess this next question is more of an umbrella question:  "Why didn't any of the following work?"  :)

    I tried instead attaching a handler via Javascript (which is how the third party wrote all of our Javascript, so it was just a matter of adding one handler next to the ones that already existed).  I couldn't do anything using Opportunity form attribute collections, since opportunityproductsGrid is a control and not an attribute.  I found that the only kind of handler I could attach to the opportunityproductsGrid control was an "addOnLoad", which seemed ideal because it runs when the Opportunity is first opened, the Opportunity Products grid is re-sorted, or (presumably) the grid is refreshed programmatically.

    I still couldn't get my code to drill down to a place I could use "setDisabled()", however.  Here's what happened:

    - The delegate I wrote has access to two form contexts, so to speak.  One is in the parameter, which I'll call "context.getFormContext()" for the purposes of this discussion.  The other is "_formContext", a global variable that is populated during the OnLoad process that still seems usable.

    - When I re-sort the grid, both context.getFormContext().getControl("opportunityproductsGrid").getGrid().getRows() and _formContext.getControl("opportunityproductsGrid").getGrid().getRows() return 0 rows, which makes it impossible to proceed; I have nothing I can enable or disable.

    - When I first open the Opportunity window, context.getFormContext() doesn't exist; and _formContext.getControl("opportunityproductsGrid").getGrid().getRows() doesn't exist (where "forEach" is shorthand to say I put it in a loop).  In other words, I can drill down to the subgrid's attributes, but none of them have any controls.  So once again, I have nothing to enable or disable.

    Pretty much throwing up my hands and leaving the editable grid as it is for the moment.  Thanks in advance for any help you can give.

    #CustomerEngagement #OnPremise #Sales #DeploymentandImplementation #Technical #Admin
    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA

  • 2.  RE: Editable Subgrid Quagmire

    Posted Dec 16, 2019 12:02 PM
    Hi Joseph,
    I've had a few headaches from the grid as well.
    Hope this helps.

    1) No, it is not editable.
    2) These radio buttons control what devices the grid will work on
    3) Not sure about this one, but you can only view directly related entities of the Opportunity Product I believe in the "sub-grid" view.
    4) I believe java script is the only way

    I can't help with 5 or 6, but I can help by recommending a different editable grid which can do all you're trying to do out of the box, and can do all you're trying to do with a little tweaking of the code, which the vendor will help with.

    Tim Dailey
    Sr Marketing CRM Administrator
    Starkey Hearing Technologies
    The CRM Dude (freelance consultant)
    Eden Prairie MN

If you've found this thread useful, dive deeper into User Group community content by role