locked
Look for more entities from one lookup field. RRS feed

  • Question

  • Hello!

    Could you please help me, if it's possible to look for more entities from one look up field?

    ( If it is possible to change Look For to different entity in 'Look Up Record Webpage Dialog' )

    While you are creating new activity->Task, you are able to change look for in regarding lookup field.

     

    Thanks.

    Saturday, February 4, 2012 11:20 AM

Answers

  • The regarding field on activities is a special system defined lookup which allows the user to select from a range of different entities. Sadly, you can't create a custom field with the same functionality.

    If you have a look N:1 relationships for the task (or any other activity) entity you will see a relationship between the task and each entity which can be selected in the regarding field.

    The approach you can take if you need similar functionality will involve creating multiple lookups for each entity type you want visible in the lookup and using JavaScript to modify the form to give the illusion of a single lookup which accepts multiple entity types.

    Take the example of having a lookup on the contact entity which allows you to select either an invoice, an order or a quote.

    You would create 3 lookups on the contact entity for each of the entity types. Each field would be on the form and you would show and hide them depending on which lookup has a value set. When a value is selected, one lookup will have a value and the other two will be empty.

    There are drawbacks to this approach, such as not being able to display a single field in a view and it will make reporting more complex.

    Using JavaScript you can modify the on click code for the lookups to display the lookup window allowing the user to select from multiple entity types. When a record has been selected, the value will be put into the appropriate lookup, which will be displayed, and the other lookups hidden.

    It's not the nicest solution, but it will give users the same form experience.

    If this is workable for you, let me know and I can give you some sample code.


    Cheers,
    Tully 

    • Marked as answer by act11 Thursday, February 9, 2012 4:26 PM
    Monday, February 6, 2012 2:07 AM

All replies

  • CRM 2011
    Saturday, February 4, 2012 11:21 AM
  • no it is not possible to look for different entities from one lookup. 
    Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    • Proposed as answer by Sam - Inogic Sunday, February 5, 2012 7:12 AM
    Saturday, February 4, 2012 12:42 PM
  • The result you want is a partylist type attribute. But in CRM, the partylist type is not a open datatype via attribute editor.
    daemon lin
    Sunday, February 5, 2012 6:41 AM
  • The regarding field on activities is a special system defined lookup which allows the user to select from a range of different entities. Sadly, you can't create a custom field with the same functionality.

    If you have a look N:1 relationships for the task (or any other activity) entity you will see a relationship between the task and each entity which can be selected in the regarding field.

    The approach you can take if you need similar functionality will involve creating multiple lookups for each entity type you want visible in the lookup and using JavaScript to modify the form to give the illusion of a single lookup which accepts multiple entity types.

    Take the example of having a lookup on the contact entity which allows you to select either an invoice, an order or a quote.

    You would create 3 lookups on the contact entity for each of the entity types. Each field would be on the form and you would show and hide them depending on which lookup has a value set. When a value is selected, one lookup will have a value and the other two will be empty.

    There are drawbacks to this approach, such as not being able to display a single field in a view and it will make reporting more complex.

    Using JavaScript you can modify the on click code for the lookups to display the lookup window allowing the user to select from multiple entity types. When a record has been selected, the value will be put into the appropriate lookup, which will be displayed, and the other lookups hidden.

    It's not the nicest solution, but it will give users the same form experience.

    If this is workable for you, let me know and I can give you some sample code.


    Cheers,
    Tully 

    • Marked as answer by act11 Thursday, February 9, 2012 4:26 PM
    Monday, February 6, 2012 2:07 AM
  • Hi

     

          is it for crm 4 or 2011. if crm 4 then try this

     

                  //set only contact
             crmForm.all.yourLookupFieldName.lookuptypes = "2,1,....";

    //set icon
    crmForm.all.yourLookupFieldName.lookuptypeIcons = "/_imgs/ico_16_2.gif,/_imgs/ico_16_1.gif,.....";

     

      add more types by separting with comma

     

    visit the url http://ronaldlemmen.blogspot.com.au/2006/12/set-default-entity-on-lookup-window.html

     

    Cheers,


    Hassan
    Monday, February 6, 2012 4:29 AM
  • hi 

     

    i am created 2 enitities (contact,lead) look ups for lead lookUp on OnLoad of Form

     

     

    	 /* Setting Multi Lookup Option for Lead */
        document.getElementById('new_leadid').setAttribute("lookuptypes", "4,2");
        document.getElementById('new_leadid').setAttribute("lookuptypeIcons", "/_imgs/ico_16_4.gif?ver=274421634:/_imgs/ico_16_2.gif?ver=274421634");
        document.getElementById('new_leadid').setAttribute("lookuptypenames", "lead:4:Lead,contact:2:Contact");

     

     

     

     


    Anwar noori
    Monday, February 6, 2012 5:32 PM
  • Wednesday, February 8, 2012 11:05 AM
    Moderator