Answered by:
how to change currency symbol based on country

Question
-
HI All,
for amount field i have given by default Rs. now my requirement is when i slect india i need to get Rs. and other countries $
can anyone suggest me how to achive this
Thanks in advance
vandana
Tuesday, May 21, 2013 8:53 AM
Answers
-
Hi Vandana,
To change currency symbol you have to change currency look-up field. You can change it by Java Script based on your country picklist.
if(Xrm.Page.getAttribute("country").getValue() == "1") //based on your country picklist
{
var oCurrency = new Array();
oCurrency[0] = new Object();
oCurrency[0].id = sCurrencyId;
oCurrency[0].entityType = "currency";
oCurrency[0].name = sCurrencyName;
Xrm.Page.getAttribute("currencyid").setValue(oCurrency);}
Then change the currency symbol for your amount field. you can achieve it by saving the record then automatically symbol will change or by JavaScript.
document.getElementById("field_name_sym").value = "$";
- Proposed as answer by Suresh Kumar Patra Wednesday, May 22, 2013 6:00 AM
- Marked as answer by Payman BiukaghazadehEditor Wednesday, May 22, 2013 4:14 PM
Tuesday, May 21, 2013 12:01 PM -
You should not use the above JavaScript. Change the lookup field of the "PriceList" based on the value of the country for the quote or other objects. You should have separate pricelists for each currency to use this functionality.
- Proposed as answer by Guido PreiteMVP Tuesday, May 21, 2013 9:44 AM
- Marked as answer by Payman BiukaghazadehEditor Wednesday, May 22, 2013 4:14 PM
Tuesday, May 21, 2013 9:42 AMModerator
All replies
-
Hi,
Obviously this means that you have separate price lists for each currency. If so, use a JavaScript to update the pricelist of a quote/order/invoice when you select the country.
- Proposed as answer by Payman BiukaghazadehEditor Tuesday, May 21, 2013 9:26 AM
Tuesday, May 21, 2013 9:26 AMModerator -
Hi,
i used below script
function currency()
{
if (Xrm.Page.getAttribute(new_import_export).getValue() == 1)
{
Xrm.Page.getAttribute('new_amount').setValue(‘$’);
}
else {
Xrm.Page.getAttribute('new_amount').setValue(‘Rs.’);
}
}but its not working
vandana
Tuesday, May 21, 2013 9:29 AM -
You should not use the above JavaScript. Change the lookup field of the "PriceList" based on the value of the country for the quote or other objects. You should have separate pricelists for each currency to use this functionality.
- Proposed as answer by Guido PreiteMVP Tuesday, May 21, 2013 9:44 AM
- Marked as answer by Payman BiukaghazadehEditor Wednesday, May 22, 2013 4:14 PM
Tuesday, May 21, 2013 9:42 AMModerator -
Hi Vandana,
To change currency symbol you have to change currency look-up field. You can change it by Java Script based on your country picklist.
if(Xrm.Page.getAttribute("country").getValue() == "1") //based on your country picklist
{
var oCurrency = new Array();
oCurrency[0] = new Object();
oCurrency[0].id = sCurrencyId;
oCurrency[0].entityType = "currency";
oCurrency[0].name = sCurrencyName;
Xrm.Page.getAttribute("currencyid").setValue(oCurrency);}
Then change the currency symbol for your amount field. you can achieve it by saving the record then automatically symbol will change or by JavaScript.
document.getElementById("field_name_sym").value = "$";
- Proposed as answer by Suresh Kumar Patra Wednesday, May 22, 2013 6:00 AM
- Marked as answer by Payman BiukaghazadehEditor Wednesday, May 22, 2013 4:14 PM
Tuesday, May 21, 2013 12:01 PM