View Full Version : FetchXML in Dynamics CRM 2011

03-20-2012, 07:07 PM
Hi all,

I need in CRM 2011 to get the count of child records that are related to the parent entity and show the count in a field on the form of the parent entity.

I have developed some javascript with some fetchXML in it and as far as i am aware it should work. What i dont know how to do is take the fetchXML and get the actual count from it. I've seen a few examples of it around but none really show what you need to do clearly.

I'll post what i have so far for if it might help:

function GetChildCount()
var solutionName = Xrm.Page.getAttribute("ts_descriptor").getValue();

var fetchXml = '<fetch mapping="logical" count="25" returntotalrecordcount="true">'
fetchXml += '<entity name="ts_solution_area_specialist">'
fetchXml += '<attribute name="ts_specialist_user_id" />'
fetchXml += '<attribute name="ts_solution_area_id" />'
fetchXml += '<attribute name="ts_solution_area_specialistid" />'
fetchXml += '<order attribute="ts_specialist_user_id" descending="false" />'
fetchXml += '<filter type="and">'
fetchXml += '<condition attribute="ts_test" operator="eq" value="717750000" />'
fetchXml += '<condition attribute="ts_solution_area_id" operator="eq" uiname="'
fetchXml += solutionName
fetchXml += '" />'
fetchXml += '</filter>'
fetchXml += '</entity>'
fetchXml += '</fetch>'



03-21-2012, 12:04 PM
can anyone help?