6. Dezember 2012 15:05
function GetAttributeValueWithOData(sSelectstatement){
var serverUrl = "http://" + window.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
var kunde = Xrm.Page.getAttribute("customerid").getValue();
var kundeid = kunde [0].id;
// Creating the Odata Endpoint
var oDataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var retrieveReq = new XMLHttpRequest();
var Odata = oDataPath + sSelectstatement;
retrieveReq.open("GET", Odata, false);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveReq.onreadystatechange = function () { retrieveReqCallBack(this); };
retrieveReq.send();
function retrieveReqCallBack(retrieveReq) {
if (retrieveReq.readyState == 4 /* complete */) {
var retrieved = this.parent.JSON.parse(retrieveReq.responseText).d;
alert(retrieved.results[0].EmailAdress1);
}
}
}
6. Dezember 2012 15:33
function GetAttributeValueWithOData(sSelectstatement){
var serverUrl = "http://" + window.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
// Creating the Odata Endpoint
var oDataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var retrieveReq = new XMLHttpRequest();
var Odata = oDataPath + sSelectstatement;
retrieveReq.open("GET", Odata, false);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveReq.send();
if (retrieveReq.readyState == 4 /* complete */) {
var retrieved = this.parent.JSON.parse(retrieveReq.responseText).d;
return retrieved.results[0];
}
}
var Kunde = new Array();
Kunde = Xrm.Page.getAttribute("customerid").getValue();
var kundeid = Kunde[0].id;
var sSelectstatement = "/ContactSet?$select=EMailAddress1&$filter=ContactId eq guid'" + kundeid + "'";
var resultKunden = GetAttributeValueWithOData(sSelectstatement);
alert(resultKunden.EMailAddress1);
6. Dezember 2012 16:04
13. Dezember 2012 09:42