Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

i am not getting data in result

$
0
0

Hi Everyone

 i am getting no data in result ,can anyone help me on this?

function camppartecipanti(){
debugger;
var Co_Marketing_NOC = 0;
var Personali_NOC = 0;
var Istituzionali_NOC = 0;
var e = document.getElementById("Consulenti");
seldEntsManager = e.value;
var f = document.getElementById("Partecipanti");
Partecipant = f.value;
var x = document.getElementById("tipologia").selectedIndex;
var currentvalue = document.getElementsByTagName("option")[x].value;
var FetchXML="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
"<entity name='campaign'>"+
"<attribute name='name' />"+
"<attribute name='istemplate' />"+
"<attribute name='statuscode' />"+
"<attribute name='createdon' />"+
"<attribute name='campaignid' />"+
"<order attribute='name' descending='true' />"+
"<filter type='and'>";
if (seldEntsManager != "") {
FetchXML = FetchXML + "<condition attribute='ownerid' operator='eq' value='{" + seldEntsManager + "}' />";
}
if (currentvalue == "last-year") {
FetchXML = FetchXML + "<condition attribute='new_data' operator='" + currentvalue + "' />";
}
else if (currentvalue != "") {
FetchXML = FetchXML + "<condition attribute='new_data' operator='next-x-months' value='" + currentvalue + "' />";
}

FetchXML = FetchXML +"</filter>"+
"<link-entity name='campaignresponse' from='regardingobjectid' to='campaignid' link-type='inner' alias='ab'>"+
"<filter type='and'>";

if (Partecipant!= "") {
FetchXML = FetchXML + "<condition attribute='new_promoterid' operator='eq' value='{" + Partecipant + "}' />";
}

FetchXML = FetchXML + "<condition attribute='new_registered' operator='eq' value='1' />"+
"<condition attribute='responsecode' operator='eq' value='100000000' />"+
"</filter>" +
"</link-entity>"+
"</entity>" +
"</fetch>";

FetchXML = "?fetchXml=" + encodeURIComponent(FetchXML);
parent.Xrm.WebApi.retrieveMultipleRecords("campaign", FetchXML).then(
function success(result) {
debugger;
for (var i = 0; i < result.entities.length; i++) {
if (result.entities[i].typecode == 4) {
Co_Marketing_NOC = Co_Marketing_NOC + 1;
}
else if (result.entities[i].typecode == 2) {
Personali_NOC = Personali_NOC + 1;
}
else if (result.entities[i].typecode == 3) {
Istituzionali_NOC = Istituzionali_NOC + 1;
}
}
$('#chartPie').remove();
$('#chartPie-container').append('<canvas id="chartPie"></canvas>');

var ctx = document.getElementById("chartPie").getContext('2d');
var data = {
datasets: [{
data: [Co_Marketing_NOC, Personali_NOC, Istituzionali_NOC],
backgroundColor: [
'#B63B2E', //Co-marketing
'#878787', //Personali
'#C6C6C6', //Istituzionali
],
}],
labels: [
'Co-Marketing',
'Personali',
'Istituzionali'
]
};
var myDoughnutChart = new Chart(ctx, {
type: 'pie',
data: data,
options: {
title: {
display: true,
text: 'Monitor Eventi'
}
}
});
},
function (error) {
debugger;
console.log(error.message);
}
);

}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images