Here is the sample JavaScript code to get account status.
Make sure you have added jquery-1.9.1.min.js and JSON2.js in Entity form libraries. If not you can download these from following URL’s
http://jquery.com/download/
http://www.json.org/js.html
function GetAccountStatus(accountId) { //var serverUrl = Xrm.Page.context.getServerUrl(); var serverUrl = location.protocol + "//" + location.host + "/" + Xrm.Page.context.getOrgUniqueName(); var odataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc" + "/" + "AccountSet?$filter=AccountId eq guid'" + accountId + "'"; $.ajax({ type: "GET", async: false, contentType: "application/json; charset=utf-8", datatype: "json", url: odataSelect, beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (data, textStatus, XmlHttpRequest) { var accountState = data.d.results[0].StateCode.Value; alert(accountState); }, error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + textStatus + errorThrown + odataSelect); } }); }