locked
How to add the same fields on the form more than once in crm 2011 on premise. RRS feed

  • Question

  • Hi All,

    I have a form with three fields, all are text fields, they are:

    Item

    Quantity

    Color

    A user may want to add more than one item and ultimately quantity and color. Is there a way where I can show the same fields as many times as a user would want it? For example after adding one item the user may want to add another. How do I achieve this functionality? 

    Tuesday, August 13, 2013 4:39 PM

Answers

  • What you can do is use a subgrid.  Subgrids let you link to other entities and add as many copies as you want.  In your case, here's how you would set it up:

    Create an entity called "Items".  On this entity, put three fields:

    Item

    Quantity

    Color

    Save and close the entity.  Go back to your original entity.  Go to "1:N Relationships".  Click on "New 1-to-Many Relationship".  For "Related Entity" chose the "Items" entity we created before.  Under "Lookup Field" set the name to "[entity name] Items" or something you'll remember.  This lookup will get put on the "Items" form and point back to your other entity.

    Next, under "Navigation Pane Item for Primary Entity" change "Use Plural Name" to "Use custom label".  Then in "Custom Label" type somthing that makes sense, like "Customer Items".  This is what we'll chose when we set up the subgrid that will display their items.  Leave the rest of the settings on their defaults and click "Save and Close".

    Open "Forms" and open your form.  Go to the "Insert" tab on the ribbon.  Choose "Sub-Grid".  In the box that appears, give your subgrid a name and a label; whatever you like.  Then under "Entity" find the "Custom Label" you used when setting up the 1:N relationship.  It should be in the list.

    The rest of the options you can play with.  I usually turn off the "Display Chart Selection" checkbox.  Click OK and the subgrid will be inserted on the form.  Save and publish your entity.  

    Now when you open a new record, you can add as many "Items" to the list as you want.  Each item can have it's own color, quantity, and item (which I assume would be it's name).

    Hope that helps!  Subgrids sound like the best solution for what you wanted.

    Ray


    • Edited by Ray in St. Louis Tuesday, August 13, 2013 8:31 PM
    • Proposed as answer by Sam - Inogic Tuesday, August 13, 2013 11:41 PM
    • Marked as answer by Hamzak Wednesday, August 14, 2013 11:55 AM
    Tuesday, August 13, 2013 8:29 PM

All replies

  • Hi,

    In CRM 2011 you can add one field multiple times but it is of no use as you can not enter different values in this field. The reason is in blackened they point to one column. whenever you will enter some value that will be reflected in other field on form.

    You can create different fields to achieve your requirement like: Quantity1, Quantity2 etc. You can keep the same label for different fields.

    Hope this helps!

    Thanks!

    Kalim Khan

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, August 13, 2013 5:12 PM
  • But I have no idea how many items a user would add. what if they are more than the fields provided? there must be a way. 

    And you mean to say I cannot change the values of the fields? what if I add an item and I want to add another Item with a different value, I wont be able to achieve it?

    Tuesday, August 13, 2013 5:14 PM
  • Hi,

    With Same field you can not achieve this.  You will have to create different fields for this.

    Hope this helps!

    Thanks!

    Kalim Khan

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, August 13, 2013 5:23 PM
  • They can be different fields with the same name? I just want the three fields to grow dynamically on the demand of the user
    Tuesday, August 13, 2013 5:26 PM
  • Hi,

    You can not create fields with the same name. the schema name/Logical name can not be same. You can give same display name to many fields but the name should be unique. see below screen shot. You can change the Display name but you can not change Name(schema name/Logical name).

    Thanks!

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, August 13, 2013 5:40 PM
  • What you can do is use a subgrid.  Subgrids let you link to other entities and add as many copies as you want.  In your case, here's how you would set it up:

    Create an entity called "Items".  On this entity, put three fields:

    Item

    Quantity

    Color

    Save and close the entity.  Go back to your original entity.  Go to "1:N Relationships".  Click on "New 1-to-Many Relationship".  For "Related Entity" chose the "Items" entity we created before.  Under "Lookup Field" set the name to "[entity name] Items" or something you'll remember.  This lookup will get put on the "Items" form and point back to your other entity.

    Next, under "Navigation Pane Item for Primary Entity" change "Use Plural Name" to "Use custom label".  Then in "Custom Label" type somthing that makes sense, like "Customer Items".  This is what we'll chose when we set up the subgrid that will display their items.  Leave the rest of the settings on their defaults and click "Save and Close".

    Open "Forms" and open your form.  Go to the "Insert" tab on the ribbon.  Choose "Sub-Grid".  In the box that appears, give your subgrid a name and a label; whatever you like.  Then under "Entity" find the "Custom Label" you used when setting up the 1:N relationship.  It should be in the list.

    The rest of the options you can play with.  I usually turn off the "Display Chart Selection" checkbox.  Click OK and the subgrid will be inserted on the form.  Save and publish your entity.  

    Now when you open a new record, you can add as many "Items" to the list as you want.  Each item can have it's own color, quantity, and item (which I assume would be it's name).

    Hope that helps!  Subgrids sound like the best solution for what you wanted.

    Ray


    • Edited by Ray in St. Louis Tuesday, August 13, 2013 8:31 PM
    • Proposed as answer by Sam - Inogic Tuesday, August 13, 2013 11:41 PM
    • Marked as answer by Hamzak Wednesday, August 14, 2013 11:55 AM
    Tuesday, August 13, 2013 8:29 PM
  • Hey Ray, 

    Thank you for such a detailed response, it was my first time making a relationship. It is exactly what i wanted but before adding the items it asks me to save the form and then allows me to add the items. Can't I just add the items from the start and save the form only once?

    Wednesday, August 14, 2013 11:55 AM
  • There should be two buttons.  One that says "Add Existing" and one that says "Add New".  It's been a while since I used a 1:N so I may be wrong.  If there is, the "Add New" should take you right to a new record and add it as soon as you save it.  "Add Existing" will have a "New" button down at the bottom you can click on and after saving the new record will take you back to the selection screen.  

    On a related note, since it sounds like you are new to subgrids, there is also a type of relationship called "N:N" or "Many-to-Many".  If you ever want to give the users a pre-made list of items to choose from but want them to be able to add as many of the pre-made items as they want, you can use a N:N and then create the items yourself.  You would need to restrict their user roles so they can't make new items (just take away create and write permissions).  This is unrelated to your current situation, just thought I'd mention it for future reference.

    Good luck with your project!

    Ray

    Wednesday, August 14, 2013 3:42 PM