Currency Symbol Changes to Dollar Sign When Updating it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 03:22 PM
Hello, I hope someone can help me or guide me with this requirement.
I have a custom table, and it has a currency field named Price. When I insert a new record, I'm able to make the currency symbol to change to Euro sign Є and by default the value is 0.00 which it is fine, then when I try to update the value in the Price field from the List View it goes back to Dollar sign.
By default, the currency is Dollar sign, but I created a business rule that when a new record is inserted, and a Vendor is equal to sys_id it should be Euro sign.
Screenshot when a record is submitted, currency in Price is Dollar sign.
After submitting, the business rule executed, and it adds a Euro sign.
If I update the Price, it goes back to Dollar sign.
This is the business rule: after insert and update, filter condition is Vendor id is sys_id.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var currency_amount = current.u_price * 50;
var currency_code = 'EUR';
var a='EUR;'+currency_amount;
current.setValue('u_price', a);
gs.info("Currency: " +a);
gs.info("Price: " +current.u_price);
})(current, previous);
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:41 PM
Hi @Diorella Angulo ,
The reason why the currency symbol is changing back to Dollar sign when you update the Price field from the List View is because you are not updating the currency code in your business rule.
(function executeRule(current, previous /*null when async*/ ) {
var currency_amount = current.u_price * 50;
var currency_code = 'EUR';
if (current.vendor_id == 'sys_id') {
current.setValue('u_price', currency_code + currency_amount);
}
gs.info("Currency: " + current.u_price);
})(current, previous);
This code will first check if the current record's vendor ID is equal to sys_id. If it is, then the code will update the currency code in the u_price field to EUR. Otherwise, the code will leave the u_price field unchanged.
Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you
Shravan
Please mark this as helpful and correct answer, if this helps you