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
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>";
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156