locked
How to choose lookup as Type RRS feed

  • Question

  • Hi,
     I have created a an atribute and wanted to choose lookup as my type. But there is no lookup in the list. Can anyone help  me with this?
    Hanoi
    Wednesday, October 21, 2009 3:37 PM

Answers

  • Hi Hanoi,

    I see what you are doing wrong.

    >>1. Created a custom Entity APTQ and added the fields and one filed that I wanted to have lookup as the type is selected varchar since lookup is not coming up.
    You do not need to add any fields at this stage. The lookup filed is not created yet.

    >>3. Then I went to contact and created a relationship as Many to one(N:1  ==>APTQ:Contact)
    You've already created the relationship 1:N. you do not need to do this again in the opposite direction. This step is not required.

    >>5. Again when I went to the Form and checked the field  that I wanted as lookup is still nvarchar and grayed out.
    When you create a 1:N relationship on the dialog where you define the primary and related entity is a field called "Display Name" This will be the name of the lookup that will need to be added to the related entity form. Once you've created the relationship and published. Go the the related entity form and click the "Add field" button. Among the list if field you will see the new field appear.

    Hope this makes it more clear.

    Hassan.

    Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/
    • Marked as answer by Matt Parks Wednesday, October 28, 2009 4:47 PM
    Wednesday, October 21, 2009 10:17 PM

All replies

  • Hi Hanoi,

    Lookups are not attributes that you can create in the same way you create text fields and picklists.

    To create a lookup attribute you will need to create a relationship between the two entities (record types).

    An example of a relationship is the one between an account and a contact. One account can have many (N) contacts associated with it. Therefore the relationship is called 1:N relationship. In this relationship the account will be the Primary entity and the contact is the related entity. 

    In this instance the related entity will have a lookup to the primary record. When you create a 1:N relationship the lookup field is automatically created by the system and is available to be added to the form on the related entity.


    You can read more about the different types of relationships between entities at the URLs below.
    http://blogs.msdn.com/ukcrm/archive/2007/10/01/microsoft-dynamics-crm-4-0-tidbits-entity-relationships.aspx
    http://blogs.msdn.com/crm/archive/2008/02/14/crm-4-0-relationships-explained.aspx
    http://www.youtube.com/watch?v=9WaGGdJTVYM

    Hassan.


    Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/
    • Proposed as answer by Hassan Hussain Wednesday, October 21, 2009 3:55 PM
    Wednesday, October 21, 2009 3:55 PM
  • Thanks Hassan!  That explains everything.
    Wednesday, October 21, 2009 4:57 PM
  • Hi Hassan,
         I tried to create a 1:N relationship but still the look up is not coming. I created a custom entity and it is 1 and the Contact is the related entity which is N
    My custom entity has more than 1 Contact. But the look up is not coming up in the field(display name)  that I selected inthe entity relationship screen
    Sorry for the confusion.
    Thanks,
    hanoi
    Wednesday, October 21, 2009 7:19 PM
  • Hi Hanoi,

    Did you publish the entity? You need to publish for the lookup attribute to be created. 

    Once you have published you need to add the lookup to the form. 

    Hassan.

    Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/
    Wednesday, October 21, 2009 7:31 PM
  • Thanks .I am doing it now and see what happens.
    Wednesday, October 21, 2009 7:58 PM
  • Hi Hassan,
    Still the type is grayed out. I published but still not working. Is there anything I need to do?
    Wednesday, October 21, 2009 8:05 PM
  • Hi Hanoi,

    Can you please explain what you mean by "type is grayed out"? A screen shot would be helpful.

    Once you have created the relationship 1:N and published the entities. You should be able to add the lookup field to the related entity form. In your case the contact form.

    Hassan.

    Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/
    Wednesday, October 21, 2009 8:21 PM
  • Hi Hassan,
        What I did was
    1. Created a custom Entity APTQ and added the fields and one filed that I wanted to have lookup as the type is selected varchar since lookup is not coming up.
    2. Then I created a relationship (1:N) where 1 is APTQ and Contact is the N(1:N ==> APTQ:Contact)
    3. Then I went to contact and created a relationship as Many to one(N:1  ==>APTQ:Contact)
    4. Then I published all.
    5. Again when I went to the Form and checked the field  that I wanted as lookup is still nvarchar and grayed out.
    I have the screen shots but not allowing to paste.
    Thanks for your patience.
    Wednesday, October 21, 2009 8:42 PM
  • Hi Hanoi,

    I see what you are doing wrong.

    >>1. Created a custom Entity APTQ and added the fields and one filed that I wanted to have lookup as the type is selected varchar since lookup is not coming up.
    You do not need to add any fields at this stage. The lookup filed is not created yet.

    >>3. Then I went to contact and created a relationship as Many to one(N:1  ==>APTQ:Contact)
    You've already created the relationship 1:N. you do not need to do this again in the opposite direction. This step is not required.

    >>5. Again when I went to the Form and checked the field  that I wanted as lookup is still nvarchar and grayed out.
    When you create a 1:N relationship on the dialog where you define the primary and related entity is a field called "Display Name" This will be the name of the lookup that will need to be added to the related entity form. Once you've created the relationship and published. Go the the related entity form and click the "Add field" button. Among the list if field you will see the new field appear.

    Hope this makes it more clear.

    Hassan.

    Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/
    • Marked as answer by Matt Parks Wednesday, October 28, 2009 4:47 PM
    Wednesday, October 21, 2009 10:17 PM
  • Thanks Hassan,
     I will do tht and see. Thanks for your Prompt mails. You Rock!!!!!
    Thursday, October 22, 2009 2:45 PM
  • Hi Hassan,
      
    Thanks for your help!!!!!!!!!!!!!!!!  
      I did what you told.
    1. Created an entity then went into Details and
    2. Created a relationship with APTQ and Contact as 1:n where 1(is for APTQ and n is for Contact) and the Type of behavior is referential and in the relationship attribute under display name(is xyz) is the name of my fields where type is lookup.
    3. Then I went to Attribute tab and created all other fields except xyz.And published it after all the fields are created.
    4. I checked the entity contacts and in there in the n:1 relationship there is the APTQ and the contact created automatically.
    5. when I went to forms and views and selected the forms there is no field called xyz.Why is it not coming?
    So I am at a loss. What is that I did wrong.
    Please help!!
    Hanoi
    Monday, October 26, 2009 6:11 PM
  • Hanoi,

    Which form are you trying to add the field to?  If APTC can have multiple Contacts, than you would be adding the XYZ field on the Contact form, not the APTC form.
    Matt, MVP - Dynamics CRM
    Wednesday, October 28, 2009 2:57 AM
  • Hi Matt,
     Thanks.
    Hanoi
    Wednesday, October 28, 2009 4:08 PM