locked
Open CRM 2013 Lookup from Javascript RRS feed

  • Question

  • One of my clients just finished an upgrade to CRM2013 from CRM2011. While most of my custom seems to be working, there is one issue that I've noticed. I have custom JavaScript on many forms that would open a Lookup window by running code similar to the following:

    window.document.getElementById('new_MyFilteredLookup').click()

    For some reason this code is no longer opening the lookups on any of the forms we have this code.  Is there another approach that should be used in CRM2013? 

    If it helps, the client is running CRM2013 SP1 and IE11.

    Thursday, June 26, 2014 4:23 PM

All replies

  • The code is not working inside CRM 2013 because it is an unsupported customization.

    The lookup control changed very much in CRM 2013 (the user need to click to the icon that appears only when the field is selected and a short lists of values appears first) due to this your code is not working anymore.

    I'm not aware of an alternative for this requirement.


    My blog: www.crmanswers.net - Rockstar 365 Profile

    Thursday, June 26, 2014 5:44 PM
  • Guido, thanks for the reply.  That's disappointing if they've not thought about this type of customization being possible in CRM2013 since opening Lookup windows via JavaScript is a common request from clients.

    I was able to programmatically open the lookup using it's URL, but when I selected a value from the lookup and pressed Add, the value wasn't brought back to the parent window. 

    I have to think someone has figured out a way to open the new inline lookup using JavaScript?

    Thursday, June 26, 2014 8:04 PM
  • try:-

    Xrm.Page.getControl('new_MyFilteredLookup').click();


    Regards Faisal

    Friday, June 27, 2014 2:50 PM
  • Hi Faisal,

    I just tried this approach and it doesn't open the Lookup.   When debugging using F12 in Internet Explorer I see the following error:

    Object doesn't support property or method 'click'.

    Friday, June 27, 2014 3:45 PM
  • This is unsupported way.

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Yogesh Vijay Mulay

    Monday, June 30, 2014 7:03 AM
  • Hi Cipher,

    Would you be able to let us know your requirement for having such a customization? We might be able to come up with another supported way to achieve what you're after.

    ~ Atomic Coder

    Monday, June 30, 2014 8:57 AM
  • Hi Atomic Coder,

    My client is using multiple filtered lookups to allow them to more easily search for various records.  Many of these custom lookup fields are hidden on the bottom of the form and were opened via custom buttons on the toolbar in CRM2011.  While we could move these lookups up near the top and train them on the new UI approach in CRM2013, the feedback we've received is they want to maintain this "shortcut" approach to clicking the custom button to open the lookup.  Also, they are creating New lookup records almost as much as often as they are Searching for them and the new records almost always require more data entry than the default "Quick Create" forms provide.

    Microsoft opens the lookup window via the "Lookup More Records" link/button so there must be a way for us to mimic this programmatically?




    • Edited by Cipher Monday, June 30, 2014 3:23 PM
    Monday, June 30, 2014 3:20 PM