Wednesday, 17 February 2016

07:54 - 1 comment

Get the Count of Annotation (notes) Records in Case Record Entity | MS CRM

Get the count of annotation (notes) records in case record entity.

First add the latest  XRMServiceToolKit, JSON and Jquery





after that add the below code in OnLoad event 


function mycountsample()
{
debugger;
var id =Xrm.Page.data.entity.getId();
var entityName = Xrm.Page.data.entity.getEntityName();
var fetchxmlcount="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+"<entity name='annotation'>"
+"<attribute name='subject' />"
+"<attribute name='notetext' />"
+"<attribute name='filename' />"
+"<attribute name='annotationid' />"
+"<order attribute='subject' descending='false' />"
+"<filter type='and'>"
+"<condition attribute='isdocument' operator='eq' value='1' />"
+"</filter>"
+"<link-entity name='incident' from='incidentid' to='objectid' alias='ab'>"
+"<filter type='and'>"
+"<condition attribute='incidentid' operator='eq' uitype='incident' value='"+id+"' />"
+"</filter>"
+"</link-entity>"
+"</entity>"
+"</fetch>";
var rCollection= XrmServiceToolkit.Soap.Fetch(fetchxmlcount);
alert(rCollection.length);
}






then refresh and open the record you will the count of annotation record..









1 comments:

Great Help !!!
Thanks,
Andy

Post a Comment