How to disable the view selector in the Add Existing on subgrid in CRM 2013 (N:N related entities) ? RRS feed

  • Question

  • I have coded like the following description: http://www.magnetismsolutions.com/blog/paulnieuwelaar/2013/02/04/filter-n-n-add-existing-lookup-dynamics-crm-2011-rollup-12

    Result: The view selector was disable likes I want but when I selected records and clicked the "Add" button, the records were not be added to the subgrid.

    And I have found out that the lookupItems was null.

    • Edited by Phong Choi Wednesday, December 4, 2013 8:13 AM
    Tuesday, December 3, 2013 4:04 AM

All replies

  • Hi,

    I hope you have followed the blog mentioned by you.

    Since the actual issue seems to be in getting the lookupItems, try with this code:

        var windowcrmform = window.parent.document.all["crmFormSubmit"];
    var lookupItems = LookupObjects(null, "multi", params.gridTypeCode, 0, null, "&currentid=" + CrmEncodeDecode.CrmUrlEncode(windowcrmform.crmFormSubmitId.value) + "&ShowNewButton=0", 1, null, null, null, null, null, viewId, [customView], null, null, null, null, 1, null, 1);

    This is the complete syntax for the lookupItems which you can modify as per your need.

    Let me know in case you need more help to get the data upto associating the selected record to the grid.

    I hope this helps to resolve your query.

    Thanks & Regards,

    Anubhav Bajpai

    • Edited by Anubhav Bajpai Tuesday, December 3, 2013 8:37 AM Updated the additional code
    Tuesday, December 3, 2013 8:36 AM
  • Thanks for your reply.

    I have followed your post and I got this error: "Error: Unable to get value of the property 'crmFormSubmitId': object is null or undefined" :(

    Wednesday, December 4, 2013 8:31 AM
  • Hi,

    it depends many times where we get the value depending on the location of the subgrid.

    try getting the value of windowcrmform as below:

    var windowcrmform = document.all["crmFormSubmit"];

    once you get the correct windowcrmform value, it will contain the crmFormSubmitId which can be passed and retrieve the value of lookupItems.

    I hope this helps,

    Thanks & Regards,

    Anubhav Bajpai

    Wednesday, December 4, 2013 9:03 AM