Today I saw one post in MS CRM development forum, where user needs to get currency symbol based on currency id, so thought to write this post to help. you can use below code to get currency symbol based on currency id
function GetCurrencySymbol() {
if(Xrm.Page.getAttribute(“transactioncurrencyid”).getValue()!=null)
{
var CurrencyID = Xrm.Page.getAttribute(“transactioncurrencyid”).getValue()[0].id;
var context = Xrm.Page.context;
var serverUrl = context.getServerUrl();
var ODataPath = serverUrl + “/XRMServices/2011/OrganizationData.svc”;
var retrieveCurrency= new XMLHttpRequest();
retrieveCurrency.open(“GET”, ODataPath + “/TransactionCurrencySet(guid'” + CurrencyID+ “‘)”, false);
retrieveCurrency.setRequestHeader(“Accept”, “application/json”);
retrieveCurrency.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
retrieveCurrency.onreadystatechange = function() {
retrieveCurrencyCallBack(this);
};
retrieveCurrency.send();
}
}
function retrieveCurrencyCallBack(retrieveCurrency) {
if (retrieveCurrency.readyState == 4 /* complete */) {
if (retrieveCurrency.status == 200) {
var retrievedParent = this.parent.JSON.parse(retrieveCurrency.responseText).d;
alert(retrievedParent.CurrencySymbol);
}
}}
Enjoy !!!