web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

"Invalid XML" error

(0) ShareShare
ReportReport
Posted on by 297

Hello Everyone!

I have created an activity in which there is a fetchXml query so my activity rurns successfully in same case and in some cases throws "Invalid XML" exception. Kindly tell me what i do? Following is query .

string recordsFetchQuery = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
                      <entity name='usnw_researchaccountmapping'>
                        <attribute name='usnw_researchaccountmappingid' />
                        <attribute name='usnw_researchaccountant' />
                        <order attribute='usnw_researchaccountant' descending='false' />
                        <link-entity name='usnw_usnw_department_usnw_researchaccountmap' from='usnw_researchaccountmappingid' to='usnw_researchaccountmappingid' visible='false' intersect='true'>
                          <link-entity name='usnw_department' from='usnw_departmentid' to='usnw_departmentid' alias='ac'>
                            <filter type='and'>
                              <condition attribute='usnw_name' operator='eq' value='"+departmentReference.Name+@"' />
                            </filter>
                          </link-entity>
                        </link-entity>
                      </entity>
                    </fetch>";

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    If this is working in some case but in some case it is giving Invalid XMl then it must be because for soem records you are gettign some spscial characters withnthe name field hence the generated xml is corrupted.

    Check this below article to handle this: www.inogic.com/.../how-to-handle-special-characters-in-fetch-xml

    Hope this helps.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Try with this  -

                              string recordsFetchQuery = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"
                                                        + "<entity name='usnw_researchaccountmapping'>"
                                                        + "<attribute name='usnw_researchaccountmappingid' />"
                                                        + "<attribute name='usnw_researchaccountant' />"
                                                        + "<order attribute='usnw_researchaccountant' descending='false' />"
                                                        + "<link-entity name='usnw_usnw_department_usnw_researchaccountmap' from='usnw_researchaccountmappingid' to='usnw_researchaccountmappingid' visible='false' intersect='true'>"
                                                          + "<link-entity name='usnw_department' from='usnw_departmentid' to='usnw_departmentid' alias='ac'>"
                                                            + "<filter type='and'>"
                                                              + "<condition attribute='usnw_name' operator='eq' value='" + departmentReference.Name + "'/>"
                                                            + "</filter>"
                                                          + "</link-entity>"
                                                        + "</link-entity>"
                                                        + "</entity>"
                                                        +"</fetch>";


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans