Set Connect To default to Account in Connection form RRS feed

  • Question

  • In Connection form, if you click on Connect To (record2id) lookup field, the default is Contact.  Is there anyway to set the default to Account?  I've already known document.getElementById("record2id").setAttribute("defaulttype", "1"); does not work.  Just try to find an alternative way.  Thanks.
    Tuesday, May 27, 2014 9:01 PM

All replies

  • Hello,

    Try to use following code:

    document.getElementById("record2id_i").setAttribute("defaulttype", "1");

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Tuesday, May 27, 2014 9:35 PM
  • Hi, Andril-

    Thanks for your quick response.  What does the 'i' mean?  Is it an iterator?

    Wednesday, May 28, 2014 12:40 AM
  • Unfortunately I have no clue.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Wednesday, May 28, 2014 4:04 AM
  • Hi,

    The "_i" refers to the field name as rendered in the CRM lookup page; it is not a iterating variable. The control from where you can select Contact/Account (customer type field) is rendered on the CRM lookup overlay page as "controlname_i". So, in order to display/hide or play with it using JavaScript we refer it as


    So, you use the following code to restrict it to Account using the following code:

    document.getElementById("record2id_i").setAttribute("defaulttype", "1");

    In Dynamics CRM 2011, this field was rendered as "record2id"; in CRM 2013 this changed to "record2id_i".

    Admin QuikView Solution for CRM 2013

    Wednesday, May 28, 2014 6:43 AM
  • Sorry, I am using it in CRM 2011.  The function is put in OnLoad of the Connection form.  document.getElementById("record2id").setAttribute("defaulttype", "1"); is proved not working in CRM 2011.  Thanks.
    Wednesday, May 28, 2014 1:18 PM