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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to concatenate or aggregate field values from multiple records in an associated entity

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I'm looking for a way to concatenate the string values from a field in a related entity. For Instance:  

From Candidate entity:

RelatedOpportunityID     Candidate Name
-------------------      -------------
1                        Mary
1                        John
1                        Sam
2                        Alaina
2                        Edward

On the Opportunity entity, we want a field "Candidates" that "joins" or "rolls up" the values with a comma and space:

ID                  Candidates
--------------      -------------
1                   Mary, John, Sam
2                   Alaina, Edward


How can we acheive this without plugin code?

-Kevin

*This post is locked for comments

I have the same question (0)
  • sai123456 Profile Picture
    324 on at

    Are you trying to do this with javascript or c# code?

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at

    Hi Kevin,

    You can use webAPI to achieve the same. JavaScript can be used to fetch the data of related records and concatenate.

    If found useful, please mark this answer as verified.

  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    Hi Kevin

    You could use the following Custom Workflow Activity to achieve this. Please follow the link below

    github.com/.../ConcatenateFromQuery.md

    You will have to decide on when you want to do the concatenation.

    I think you could create a workflow on candidates entity, possibly on Create/Field Change and then use the above CWA to concatenate and update the opportunity record with concatenated values.

  • Verified answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    Follow below steps to achieve this:

    1. Create Multi text field on opportunity entity with name "Candidates"

    2. Write a plugin on create of Candidates.You will get opportunity id  from target entity, retrieve opportunity Candidates field with help of opportunity id, Append new candidate name in existing opportunity's Candidates then update opportunity:

  • KevinStone Profile Picture
    15 on at

    Thanks for the answer. I was hoping for a no-code solution

  • Suggested answer
    KevinStone Profile Picture
    15 on at

    The custom workflow activity seems like the closest to a no-code solution, thank you. We ended up writing a plugin, but want to give it a try next time to avoid more code.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans