function player()
{
var id = Xrm.Page.data.entity.attributes.get("ccs_playername2").getValue();
alert(id[0].name);
var serverUrl = "http://"+window.location.host+"/" + Xrm.Page.context.getOrgUniqueName();
if(id!=null)
{
var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
{
var id = Xrm.Page.data.entity.attributes.get("ccs_playername2").getValue();
alert(id[0].name);
var serverUrl = "http://"+window.location.host+"/" + Xrm.Page.context.getOrgUniqueName();
if(id!=null)
{
var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var retrieveReq = new XMLHttpRequest();
//replace with your odata query
var Odata = ODataPath + "/ccs_informationSet?$select=ccs_jersey&$filter=ccs_informationId eq guid'" + id[0].id + "'";
retrieveReq.open("GET", Odata, true);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveReq.onreadystatechange = function () { retrieveReqCallBack(this); };
retrieveReq.send();
}
}
//replace with your odata query
var Odata = ODataPath + "/ccs_informationSet?$select=ccs_jersey&$filter=ccs_informationId eq guid'" + id[0].id + "'";
retrieveReq.open("GET", Odata, true);
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) {
var retrieved =this.parent.JSON.parse(retrieveReq.responseText).d;
//for (i = 0; i < retrieved.results.length; i++) {
if (retrieveReq.readyState == 4) {
var retrieved =this.parent.JSON.parse(retrieveReq.responseText).d;
//for (i = 0; i < retrieved.results.length; i++) {
// statecode = retrieved.results[i].ccs_jersey;
//alert(statecode);
//}
var statecode = retrieved.results[0].ccs_jersey;
alert(statecode);
Xrm.Page.data.entity.attributes.get("ccs_jerseyno").setValue(statecode);
}
}
No comments:
Post a Comment