locked
How to set defaulttype for lookup in crm2013? RRS feed

  • Question

  • Hi

    In 2011 for lookup below line working fine.. but in 2013 i am not able to set... please let me know if any one knows..

    document.getElementById("regardingobjectid").setAttribute("defaulttype", "2");

    Thanks,

    sravan.J


    • Edited by sravan J Wednesday, October 30, 2013 9:05 AM better performance
    Friday, October 25, 2013 7:45 AM

All replies

  • in crm 2013 we should use only XRM API object method...

    so try to use code as:

    Xrm.Page.getControl("regardingobjectid").setDefaultView("a2d479c5-53e3-4c69-addd-802327e67a0d");


    Muhammad Sohail

    Saturday, October 26, 2013 5:28 PM
  • Hi Sohail,

    Thanq for u r reply.

    I have tried with this also. But this is for setting defaultview.

    I want to set default type(means account or contact like that).

    Monday, October 28, 2013 10:43 AM
  • you must use both lines...

    Please check the following code.

    document.getElementById("regardingobjectid").setAttribute("defaulttype", "2"); Xrm.Page.getControl("regardingobjectid").setDefaultView("a2d479c5-53e3-4c69-addd-802327e67a0d");

    The first line sets the default entity type to Contact for the Customer Lookup dialog.

    The second line sets the Customer Lookup dialog’s view to the ‘Contacts Lookup View’ using its guid value. If you do not use this line of code it will default to the ‘My Active Contacts View’ or whatever you have selected as the default Contact view.


    Muhammad Sohail




    • Edited by sohail450 Monday, November 4, 2013 12:50 PM
    Monday, November 4, 2013 12:46 PM
  • sohail,

    i have tried this also... not working..

     
    Wednesday, November 6, 2013 6:33 AM