function test() {
debugger;
var output=true;
var documents ="";
var entityId = Xrm.Page.data.entity.getId();
var fetchXml1 =
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' >" +
"<entity name='documents'>" +
"<attribute name='documentsid' />" +
"<attribute name='name' />" +
"<attribute name='modifiedby' />" +
"<attribute name='documenttypenewid' />" +
"<attribute name='documenttype' />" +
"<attribute name='createdby' />" +
"<order attribute='createdon' descending='true' />" +
"<filter type='and'>" +
"<condition attribute='documenttypenewid' operator='eq' value='" + entityId + "'/>" +
"</filter>" +
"</entity>" +
"</fetch>";
if (entityId !== null) {
var retrieveddocs = XrmServiceToolkit.Soap.Fetch(fetchXml1);
for (var i = 0; i < retrieveddocs.length; i++) {
var docCount=retrieveddocs.length;
var fetchXml =
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' >" +
"<entity name='annotation'>" +
"<attribute name='subject' />" +
"<attribute name='notetext' />" +
"<attribute name='filename' />" +
"<attribute name='annotationid' />" +
"<attribute name='modifiedby' />" +
"<attribute name='filesize' />" +
"<attribute name='isdocument' />" +
"<attribute name='createdby' />" +
"<order attribute='createdon' descending='true' />" +
"<link-entity name='documents' from= 'documentsid' to= 'objectid' link-type='inner' alias= 'ad'>" +
"<attribute name='documenttype' />" +
"<filter type='and'>" +
"<condition attribute='documentsid' operator='eq' value='" + retrieveddocs[i].id + "'/>" +
"<condition attribute='documenttypenewid' operator='eq' value='" + entityId + "'/>" +
"</filter>" +
"< /link-entity>" +
"</entity>" +
"</fetch>";
var retrievedNotes = XrmServiceToolkit.Soap.Fetch(fetchXml);//facing issue here when i do in IE node is null but same works in chrome
if (retrievedNotes.length ==0)
{
output=false;
documents +=retrieveddocs[i].attributes.vox_documenttype.formattedValue+"";
}
}
if(output !=true)
{
alert("Kindly attach the documents for " + documents)
}
}
}
*This post is locked for comments