locked
case entity customer lookup RRS feed

  • Question

  • Hi All,

    In case entity we are having Customer lookup

    Customer lookup is multi  entity selection 1.account 2.contact

    I need to set this default as contact?

    but by default it is showing account

    how can i set default as contact?


    Rammohan

    Tuesday, July 8, 2014 11:14 AM

All replies

  • Hi,

    Use the following script:

    setTimeout(function() {
    document.getElementById("customerid_i").setAttribute("defaulttype", "2");
    }, 1000);
    


    Admin QuikView Solution for CRM 2013


    Tuesday, July 8, 2014 11:19 AM
  • I have to write this script in on page load?

    Rammohan

    Tuesday, July 8, 2014 11:39 AM
  • Hi

    i have called the setTimeout() in Onformload

    it's not working.. can you please suggest me on this


    Rammohan

    Tuesday, July 8, 2014 12:04 PM
  • Hi Dyna,

    I have tried with ur function it's not working

    setTimeout(function() {
    document.getElementById("customerid").setAttribute("defaulttype", "1");
    }, 1000);

    function onFormLoad()
    {
      document.getElementById("customerid").setAttribute("lookuptypes", "1");
        document.getElementById("customerid").setAttribute("defaulttype", "1");
    }

    can you pls sugget it?


    Rammohan

    Tuesday, July 8, 2014 12:14 PM
  •  Hi,

    It will be like:

    function OnLoad()
    {
       setTimeout(function() {
       document.getElementById("customerid_i").setAttribute("defaulttype", "2");
       }, 1000);
    }
    

    Have this function on Page OnLoad. Also, please change the "customerid" to the actual field name if it differs.


    Admin QuikView Solution for CRM 2013

    Tuesday, July 8, 2014 7:26 PM
  • Hi Dyna,

    I have tried the same    but it's not working.

    In case entity we are having customerid as OOB control ..

    can you please try same for ur Instance.. am using CRM online

    function OnLoad()
    {
       setTimeout
    (function() {
       document
    .getElementById("customerid").setAttribute("defaulttype", "2");
      
    }, 1000);
    }


    Rammohan

    Wednesday, July 9, 2014 4:13 AM
  • Hi Rammohan,

    Try with this, the Default View Id was missing in the code:

    function OnLoad()
    {
       setTimeout(function() {
       document.getElementById("customerid_i").setAttribute("defaulttype", "2");
       document.getElementById("customerid_i").setAttribute("DefaultViewId", "{A2D479C5-53E3-4C69-ADDD-802327E67A0D}");
       }, 1000);
    }

    Verify once that the Contact Lookup View Id is A2D479C5-53E3-4C69-ADDD-802327E67A0D


    Admin QuikView Solution for CRM 2013



    Wednesday, July 9, 2014 5:48 AM
  • Hope this is what you are looking for 

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

    Good luck...!

    Sreeni


    Sreeni Pavalla

    Wednesday, July 9, 2014 6:02 AM
  • Hi sreeni,

    how i will get the defualt view id..

    my application  online application..

    I tried the same code but it's not working

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

    i think  vew id is the problem.. can you please guide me on this..


    Rammohan

    Wednesday, July 9, 2014 6:12 AM
  • Mohan,

    CRM 2011:

    The quickest way I have found to get this from CRM is to go into the account form or the form you want the guid from.

    Then press F11, this will maximise the screen.  It also shows the url bar at the top.  You can then

    http://crmdevmscrm/Demo/main.aspx?etc=1&extraqs=%3f_gridType%3d1%26etc%3d1%26id%3d%257b92EB0D0E-B22E-E011-9645-00155D106B02%257d%26rskey%3d246505345&pagetype=entityrecord

    The guid is the bit after ID and up to the %26

    id%3d%257b92EB0D0E-B22E-E011-9645-00155D106B02%257d%26

    the b%3d%257 is the first curly bracket { and the %257d%26 is the closing curly bracket, take those out and you are left with the guid

    92EB0D0E-B22E-E011-9645-00155D106B02

    CRM 2013:

    Are you aware of Developer tools in IE? If not press F12, It is easy to find it.

    This article has more info

    http://crmbusiness.wordpress.com/2014/01/15/crm-2013-quick-way-to-get-the-guid-on-a-form/

    Thank you,


    Sreeni Pavalla


    Wednesday, July 9, 2014 6:28 AM
  • Hi Sreeni,

    i tried the same but it's not working

    it showing default account view only

     function OnFormLoad()
    {
    document.getElementById("customerid").setAttribute("defaulttype", "2");
    Xrm.Page.getControl("customerid").setDefaultView("A9AF0AB8-861D-4CFA-92A5-C6281FED7FAB");
    }


    Rammohan

    Wednesday, July 9, 2014 6:32 AM
  • Did you get the GUID?

    if not this is how you can get.

    The quickest way I have found to get this from CRM is to go into the account form or the form you want the guid from.

    Then press F11, this will maximise the screen.  It also shows the url bar at the top.  You can then

    http://crmdevmscrm/Demo/main.aspx?etc=1&extraqs=%3f_gridType%3d1%26etc%3d1%26id%3d%257b92EB0D0E-B22E-E011-9645-00155D106B02%257d%26rskey%3d246505345&pagetype=entityrecord

    The guid is the bit after ID and up to the %26

    id%3d%257b92EB0D0E-B22E-E011-9645-00155D106B02%257d%26

    the b%3d%257 is the first curly bracket { and the %257d%26 is the closing curly bracket, take those out and you are left with the guid

    92EB0D0E-B22E-E011-9645-00155D106B02

    Thanks,


    Sreeni Pavalla

    Wednesday, July 9, 2014 6:34 AM
  • Hi Rammohan,

    Did you try using my code? It is tested and works for CRM Online. By the way, the Contact Lookup View Id is the same for all organizations since it comes out of the box.


    Admin QuikView Solution for CRM 2013


    Wednesday, July 9, 2014 6:36 AM
  • Hi Sreeni,

    I tried ur code  but it's not working for me..

     function OnFormLoad()
    {
    document.getElementById("customerid").setAttribute("defaulttype", "2");
    Xrm.Page.getControl("customerid").setDefaultView("92EB0D0E-B22E-E011-9645-00155D106B02");
    }


    Rammohan

    Wednesday, July 9, 2014 8:02 AM
  • Hi,

    The Id is A2D479C5-53E3-4C69-ADDD-802327E67A0D

    function OnLoad()
    {
       setTimeout(function() {
       document.getElementById("customerid_i").setAttribute("defaulttype", "2");
       document.getElementById("customerid_i").setAttribute("DefaultViewId", "{A2D479C5-53E3-4C69-ADDD-802327E67A0D}");
       }, 1000);
    }


    Admin QuikView Solution for CRM 2013

    Wednesday, July 9, 2014 8:29 AM