web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to concatenate N:N sub-grid record names into a single-line text field?

(0) ShareShare
ReportReport
Posted on by

In my organization our support Cases can be linked to many Products so I've created an N:N relationship between Cases and Products and added a sub-grid to each entities' form.  The problem I'm running into now is in our Case views we want to see the list of related products in a column.  The best way I can think to do that is to just create a custom string field on the Case record called 'Product List' and to somehow populate that string field with a concatenated list of related Product names.  Does anyone have any suggestions on how to do this?  I've used Ribbon Workbench before to add/append custom JavaScript to various buttons, but I don't know which buttons/commands to modify to capture both Adding and Removing a record from the sub-grid.

I've considered using a manually controlled N:N relationship with a custom entity called 'Product List'.  However I still want this 'Product List' entity to be transparent to the user, IE they see a sub-grid of Products on the case form and a sub-grid of Cases on the Product form.  By definition I don't think this can be done with a manual relationship.

I've also considered using a manually controlled relationship AND a native N:N relationship.  The native relationship would control the sub-grids on the for, while the manual relationship and custom entity would provide the string field.  However I'm lost when I come to thinking about how to link the two N:N relationships.  I also think this is way more complicated than it needs to be.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at

    Hi KG CRM,

    If you want to put in the text field, can, but you need to write plugin associated and diassociate to automatically copy and remove from the text.

    But remember, a text field is not unlimited length, so you probably need more field to store more product.

    Thanks

  • KG_CRM Profile Picture
    on at

    Thanks, Aileen.  A plug-in approach would probably be simpler, but writing and publishing plug-ins is not in my "bag of tricks".

    I can create a multi-line text field and set it to 1048576 characters long (i.e. 2^20) which would be a lot of products, but you are right, it is not infinite.  If I used a single-line text field I'm limited to 4000 characters which is still more than sufficient for our needs, but it would not display as nicely on a form.

  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi KG,

    A plugin is going to be the only practical way to accomplish this. You could also look at 3rd party tools that might help with this, but there's nothing else you can do OOB with CRM to meet the requirement.

    Thanks,

     Aiden

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi KG

    Plugin is the only way for this.

    Unless you want to use the intersect entity then there is a possibility you can use workflow to concat.

    Hope this helps.

    Thanks

  • KG_CRM Profile Picture
    on at

    I've been able to modify the Case sub-grid's '+' button command before using Ribbon Workbench.  I think I could do something similar here with the Product's Sub-grid to add text to a 'Product List' string field, but I do not know if there is a corresponding delete/remove command I can replace/modify to remove text from the string field.  I would also have to do the same thing for the Case sub-grid that would be displayed on the Product form.

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi KG

    You can use the ribbon and js as well but I believe that that is too hardcore and plugin is still less effort.

    Thanks

  • Dani123 Profile Picture
    10 on at

    Hi Guys

    Did anyone of you have a sample Plugin for above mentioned scenario to copy a value into a text field on Associate/Dissociate of Record in Many to Many?
    many thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans