Skip to main content



No record found.

Microsoft Dynamics CRM forum

Facing issue while retrieving text using fetchxml

Posted on by 30


We are facing issue while retrieving text using fetchxml.

Scenario: We have implemented search bar using angular in which we have to search for a word or any other symbols and need to highlight that word or symbol.

We are retrieving the description field value that is present on the email entity. This field is a Microsoft OOB control which is Rich Text Editor to add font size, color, images, and so on. It stores data in html format.

Problem: Whenever we search in description it searches in the html as well, which should not happen.

E.g. In the below email description, the slash or div are present in the background value but not on the front end value.


If we search “/” or “div” then above email is also retrieving.

We want to retrieve only those emails who has “/” or “div” present in their text and not in the html.

We thought to store the innertext value in a new field. For retrieving we use that value.

E.g. retrieve email contains ikl_plaindescription eq “/”.

For highlighting the text we are replacing the searched value with <span style= “background-color :yellow”> searched value </span>.

Because the html contains ”/”, the slash before the closing div tag also gets replaced which in turn generate incorrect html

We tried using few regex expressions which didn’t help.


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 . . .


André Arnaud de Calavon Profile Picture

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

Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans