Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to escape an apostrophe in addCustomFilter Client API function

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans