Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

OData call is returning 400 error.

$
0
0

Hello Experts,

var entityNameSet = "IncidentSet"; //Entity Name

var entityIdAttr = Xrm.Page.data.entity.getEntityName() + 'Id'; //Entity ID field name

var hasRelated = false;
//Related activities are retrieved by using the relationship named "Entity name"_ActivityPointers
var oData = "/" + entityNameSet + "?$select=" + entityIdAttr + "," + Xrm.Page.data.entity.getEntityName() + "_ActivityPointers&$expand=" + Xrm.Page.data.entity.getEntityName() + "_ActivityPointers&$filter=" + entityIdAttr + " eq guid'" + Xrm.Page.data.entity.getId() + "'";

var oPath ="https://******.crm.dynamics.com/XRMServices/2011/OrganizationData.svc";
var request = new XMLHttpRequest();

request.open("GET", oPath + oData, false); //Synchronous operation
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=utf-8");
request.onreadystatechange = function () {

if (request.readyState == 4) {
alert(request.status);
if (request.status == 200) {
}
}
}

I'm using above code to get the activities related to a case record. But this OData call is returning 400 , Bad request error.

My requirement is to set a field in case form to True if there are any active activities related to that particular case record. Please let me know what is the mistake 'm doing and how to correct this or how to achieve my requirement in a better way.

thank you


Thanks and Regards. MadhuSudhan M


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>