Skip to main content

Notifications

Announcements

No record found.

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

  • SheaLeonard Profile Picture
    SheaLeonard 5 on at
    RE: How to escape an apostrophe in addCustomFilter Client API function

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

  • Goksel oral Profile Picture
    Goksel oral 25 on at
    RE: How to escape an apostrophe in addCustomFilter Client API function

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

    weblogs.sqlteam.com/.../

  • SheaLeonard Profile Picture
    SheaLeonard 5 on at
    RE: How to escape an apostrophe in addCustomFilter Client API function

    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

  • Suggested answer
    RodRodriguez Profile Picture
    RodRodriguez on at
    RE: How to escape an apostrophe in addCustomFilter Client API function

    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

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans