{"id":748,"date":"2012-06-14T14:27:45","date_gmt":"2012-06-14T14:27:45","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=748"},"modified":"2012-06-14T14:27:45","modified_gmt":"2012-06-14T14:27:45","slug":"get-currency-symbol-based-on-currency-id","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=748","title":{"rendered":"Get Currency symbol based on currency ID"},"content":{"rendered":"<p>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<\/p>\n<p>function GetCurrencySymbol() {<\/p>\n<p>if(Xrm.Page.getAttribute(&#8220;transactioncurrencyid&#8221;).getValue()!=null)<br \/>\n{<br \/>\n\u00a0\u00a0\u00a0 var CurrencyID = Xrm.Page.getAttribute(&#8220;transactioncurrencyid&#8221;).getValue()[0].id;<br \/>\n\u00a0\u00a0\u00a0 var context = Xrm.Page.context;<br \/>\n\u00a0\u00a0\u00a0 var serverUrl = context.getServerUrl();<br \/>\n\u00a0\u00a0\u00a0 var ODataPath = serverUrl + &#8220;\/XRMServices\/2011\/OrganizationData.svc&#8221;;<br \/>\n\u00a0\u00a0\u00a0 var retrieveCurrency= new XMLHttpRequest();<br \/>\n\u00a0\u00a0\u00a0 retrieveCurrency.open(&#8220;GET&#8221;, ODataPath + &#8220;\/TransactionCurrencySet(guid'&#8221; + CurrencyID+ &#8220;&#8216;)&#8221;, false);<br \/>\n\u00a0\u00a0\u00a0 retrieveCurrency.setRequestHeader(&#8220;Accept&#8221;, &#8220;application\/json&#8221;);<br \/>\n\u00a0\u00a0\u00a0 retrieveCurrency.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;application\/json; charset=utf-8&#8221;);<br \/>\n\u00a0\u00a0\u00a0 retrieveCurrency.onreadystatechange = function() {<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 retrieveCurrencyCallBack(this);<br \/>\n\u00a0\u00a0\u00a0 };<br \/>\n\u00a0\u00a0\u00a0 retrieveCurrency.send();<br \/>\n\u00a0\u00a0\u00a0 }<\/p>\n<p>}<br \/>\nfunction retrieveCurrencyCallBack(retrieveCurrency) {<br \/>\n\u00a0\u00a0\u00a0 if (retrieveCurrency.readyState == 4 \/* complete *\/) {<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (retrieveCurrency.status == 200) {<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var retrievedParent = this.parent.JSON.parse(retrieveCurrency.responseText).d;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(retrievedParent.CurrencySymbol);<\/p>\n<p>}<br \/>\n\u00a0<br \/>\n}}<\/p>\n<p>\u00a0Enjoy !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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(&#8220;transactioncurrencyid&#8221;).getValue()!=null) { \u00a0\u00a0\u00a0 var CurrencyID = Xrm.Page.getAttribute(&#8220;transactioncurrencyid&#8221;).getValue()[0].id; \u00a0\u00a0\u00a0 var context = Xrm.Page.context; \u00a0\u00a0\u00a0 var serverUrl&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=748\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/748"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=748"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}