Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to handle special characters in Fetch XML while using Web API in JavaScript

Posted on by 65

Hi Experts, 

How can we handle special characters like &, ', etc., while retrieving records using WebAPI in JavaScript.

I tried using encodeURI and encodeURIComponents, but everything fails with the below error.

"No other query options are supported when a SavedQuery, UserQuery, or FetchXml parameter is provided"

Please help me with the issue.

*This post is locked for comments

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to handle special characters in Fetch XML while using Web API in JavaScript

    Hi,

    Can you please install Rest Builder on your CRM instance and try generating code from this tool.

    github.com/.../releases

    Please mark my answer verified if i were helpful

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to handle special characters in Fetch XML while using Web API in JavaScript

    Its a two step process to handle special symbols in fetch xml with WEB API.

    1. Use html encoding on the filter value.

    2. Use url encoding for entire fetch xml.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: How to handle special characters in Fetch XML while using Web API in JavaScript

    Could you share the code so that we could see if we can spot any issues with Fetch or the request?

    Also have look at the following link, it might help a bit

    community.dynamics.com/.../304574

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans