Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

Create a list of items in a form for use in a new entity

Posted on by 1,185

I need to create a new entity, and have it contain a list of products from our product list.

I have yet to figure out how to make a list possible. I can do a single reference, but I cannot figure out how to do multiples.

Any help is appreciated.

  • Brandon_P Profile Picture
    Brandon_P 1,185 on at
    RE: Create a list of items in a form for use in a new entity

    As this is a new activity, a 1:N relationship should be allowed, as we are a "new" 1 for the table entry. ( the activity is the one ).

    However, in theory there should be many activities referencing many products (unique or not)

    A 1:N relationship only allows 1 record in table A to be associated with a record in Table B

    Many records from Table B can be associated with  a record in A, however the reverse is not true.

    So this requires a N:N relationship.

    Activities can not have a N:N relationship )which doesnt make sense to me, but thats besides the point, must be preformance based)

    We now need a lookup table with 1: in both directions (lookup entity) to connect the two tables, however how do we update this lookup table with new information in products.  Do I need to put in a trigger or something that adds a new record to the look up entity each time a new product is added?

  • Brandon_P Profile Picture
    Brandon_P 1,185 on at
    RE: Create a list of items in a form for use in a new entity

    Create a 1:N relationship between the activity and Products: Check

    Add a Product List (sub grid of products): Check

    Create an activity with references to a product: Check

    Create Activity2, attempt to associate product 1 to it: get an error:

    <code>

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=redact]]: This record cannot be added because it already has a parent record.Detail:

    <OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance&quot; xmlns="schemas.microsoft.com/.../Contracts&quot;>

     <ErrorCode>-2147187592</ErrorCode>

     <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic&quot; />

     <Message>This record cannot be added because it already has a parent record.</Message>

     <Timestamp>2015-02-05T21:22:31.4806444Z</Timestamp>

     <InnerFault i:nil="true" />

     <TraceText i:nil="true" />

    </OrganizationServiceFault>

    </code>

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create a list of items in a form for use in a new entity

    Thats what is happening with 1:N relationship; so for e.g.My salesperson1 ask for Sample Request to Customer A

    Sample Request Name 1 can contain Product A + Product B + Product C

    Salesperson2 asks for Sample request to Customer B

    Sample Request Name 2 can contain Product A + Product B + Product C + Product D + Product E

    Salesperson1 asks for sample request to Customer ABC

    Sample Request name 3 can contain Product A + Product B +Product C (again)

  • Brandon_P Profile Picture
    Brandon_P 1,185 on at
    RE: Create a list of items in a form for use in a new entity

    As a 1:N relationship I cant seem to add the same product to another activity. I will make a new frum post for this.

    N:N is required I believe. As many Sample Reqeusts (new entity) will be related to many Products.

  • Verified answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create a list of items in a form for use in a new entity

    Hi Brandon,

    Do it like this:

    Click on + button

    4544.11.PNG

    Click on new or look up more records or select from list

    C8463.22.PNG

    Otherway is

    44.PNG

    And add existing or new

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create a list of items in a form for use in a new entity

    Hi Brandon,

    Try the following:

    www.crmsoftwareblog.com/.../working-with-subgrids-in-microsoft-dynamics-crm-2013

    sending u screenshots in a moment

  • Brandon_P Profile Picture
    Brandon_P 1,185 on at
    RE: Create a list of items in a form for use in a new entity

    Explorer not chrome.......... there is the missing piece.

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create a list of items in a form for use in a new entity

    Click on save & publish and also do this on Internet explorer not google chrome

  • Verified answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create a list of items in a form for use in a new entity

    Add a table/subgrid to add multiple products like below:

    Go to custom entities form>>Insert>>subgrid

    7701.2.PNG

    As soon as you select Subgrid>>system asks you to select

    Click Ok and then Save & Publish

  • Brandon_P Profile Picture
    Brandon_P 1,185 on at
    RE: Create a list of items in a form for use in a new entity

    But I am still unsure on how to make a table for selecting multiple products to go with my sample request.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans