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 365 | Integration, Dataverse...
Suggested Answer

How to escape an apostrophe in addCustomFilter Client API function

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

I am having some issues attempting to escape an apostrophe whilst using the addCustomFilter Client API function. 

I have tried a number of different methods but continue to get "Invalid XML Format" error message. I was able to successfully escape an ampersand character using &amp.

Here are some of the things I have tried:

  • Using ' to escape the apostrophe.
  • Using &39; to escape the apostrophe.
  • Built a string variable into fetch xml but still getting the same issue.
  • Instead of using equal to in the fetch query I used contains but still getting the error message.
  • Tried escaping using HTML character references - still no luck.

Has anyone experienced this issue before?

Thanks,

Shea

I have the same question (0)
  • Suggested answer
    RodRodriguez Profile Picture
    on at

    Howdy!

    I believe you are looking for this:  

    '

    docs.oracle.com/.../obcCustomXml.htm

    Also here is the Microsoft docs as well:

    docs.microsoft.com/.../xml-character-entities

  • SheaLeonard Profile Picture
    5 on at

    Hi Rod,

    Thanks for your reply.

    Unfortunately I have also tried this and to no avail (including the #). To get around it I have had to find that record by GUID in the filter query.

    Thanks,

    Shea

  • Goksel oral Profile Picture
    25 on at

    Have you tried the method -  System.Security.SecurityElement.Escape(string) to replace those and other methods mentioned below

    weblogs.sqlteam.com/.../

  • SheaLeonard Profile Picture
    5 on at

    This is JavaScript issue and not C# but thanks for the response.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 53 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans