Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Concatenate the string and reduce the duplicate data

Posted on by 932

function commonFlag() {
var GUIDvalue = Xrm.Page.data.entity.getId();
alert(GUIDvalue);

var fetchXml = "<fetch mapping='logical' distinct='false'>"
+ "<entity name='account'>"
+ "<attribute name='new_choosedflag' alias='flagstring'/>"
+ "<link-entity name='account' from='accountid' to='accountid' link-type='inner' alias='ab'>"
+ "<filter type='and'>"
+ "<condition attribute='accountid' operator='under' value='" + GUIDvalue + "' />"
+ "</filter>"
+ "</link-entity>"
+ "</entity>"
+ "</fetch>";
alert(fetchXml);

}

Above code is used to fetch the data of flag of child accounts. I want to concatenate  all the  childs flag value and remove the duplicate data.

How i concatenate and remove the duplicate of flag data and display it on another field?

*Flag: - Red, White, Yellow, Orange, Black

*This post is locked for comments

  • RE: Concatenate the string and reduce the duplicate data

    How i concatenate the values of array and the values are unknown?

  • Suggested answer
    Shidin Haridas Profile Picture
    Shidin Haridas 3,497 on at
    RE: Concatenate the string and reduce the duplicate data

    1. If you are just trying to retrieve all the child accounts under a particular account, you don't have to use the link entity.

    You can directly put that as a filter.

    (Again, use the CRM REST Builder)

    2. Loop through all the child accounts, (for or foreach loop in Javascript)

    3. Push the distinct values into a new array.

    4. Concatenate the new array into a string.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans