简体   繁体   中英

CRM2011 Unable to retrieve Lookup Filter selected Values in Javascript

Here is the scenario:

  1. I have added a ribbon button on contact Form. On clicking, it loads a modal dialog as shown below:

在此处输入图片说明

  1. When I click on custom lookup icon button on modal dialog, I launch Lookup Filter Window using code below:
function OpenLookup() {

    var objectCode = "2";

    var url = serverURL+"/_controls/lookup/lookupinfo.aspx? AllowFilterOff=1&DefaultType=1&DefaultViewId={A9AF0AB8-861D-4CFA-92A5- C6281FED7FAB}&DisableQuickFind=0&DisableViewPicker=0&LookupStyle=single&ShowNewButton=1&Show PropButton=1&browse=false&currentObjectType=2&currentid={7D2D14AE-7EE1-E311-B136- 00155D02101E}&objecttypes=1%2c2";

    var lookUp = window.open(url, null,  "width=500,resizable=1,height=400,menubar=0,status=1,location=0,toolbar=0,scrollbars=1",  null);
    if (lookUp != null) {
        var selectedVal = lookUp.items[0].name;

    }
}

When I parse the resultant object lookUp , it does not have any variable items . So I am unable to retrieve selected values in lookup filter window.

Any help would be appreciated.

Thanks.

Here is how I do it:

 var UpdatedAccountId;
 var UpdatedAccountName = "";
 var lookUp = window.showModalDialog(url, "entity", "dialogwidth: 450; dialogheight: 300; resizable: yes");         
 var updated = JSON.parse(lookUp);

for (i = 0; i < updated.items.length; i++) {
    if (updated.items[0].id != null) 
     {
            UpdatedAccountId = updated.items[0].id;       
     }
    if (updated.items[0].name != null)
     {
           UpdatedAccountName = updated.items[0].name;         
     }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM