locked
how to change currency symbol based on country RRS feed

  • 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 = "$";

    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.


    My Weblog | My Website

    Tuesday, May 21, 2013 9:42 AM
    Moderator

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.



    My Weblog | My Website

    Tuesday, May 21, 2013 9:26 AM
    Moderator
  • 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.


    My Weblog | My Website

    Tuesday, May 21, 2013 9:42 AM
    Moderator
  • 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 = "$";

    Tuesday, May 21, 2013 12:01 PM