When a currency field is updated via client script using g_form.setValue(field_name, value);, the currency code is not set to the session currency, but to US dollars (USD).
Steps to Reproduce
- Do one of the following with the currency setting:
- log in as a user with a local currency other than USD
- open a record with a value in currency other than USD
- manually set the field value to a currency other than USD
- Execute a client script that sets the value on a currency field using g_form.setValue(field_name, value);.
Note that the currency is changed to USD. The session currency, or the currency that is currently set on the field, shoudo be preserved.
Instead of scripting to set the value only, the setValue should be used to set the display value in the required currency and another line should be added to force the required currency to display.
Consider the following code:
g_form.setValue(field_name, currency_code+';'+currency_amount); g_form.setValue(field_name+'.currency', currency_code);
Note: The order here is very important - the last line should be the one to force the required currency to display.
Related Problem: PRB742211