Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Replace comma with dot in currency field

Jo_o Pedro
Tera Expert

I'm trying to replace a comma for a dot in a currency field but I'm failing with the script

This is the script

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var contractCost = g_form.getValue('u_contract_cost');

    var dot = contractCost.replace(/,/g, '.');
    g_form.setValue('u_contract_cost', dot);
}

This is the field and the error that is returning

Jo_oPedro_2-1670609556073.png

 

 

 

 

1 ACCEPTED SOLUTION

Paul Curwen
Giga Sage

IT is probably down to your browser or users Locations. This is the probable solution. 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0830639

 

Let me know if this works. 

 

Please mark as Helpful/Correct if helpful. 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

View solution in original post

2 REPLIES 2

Paul Curwen
Giga Sage

IT is probably down to your browser or users Locations. This is the probable solution. 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0830639

 

Let me know if this works. 

 

Please mark as Helpful/Correct if helpful. 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

It was exactly this.

 

Thank you, Paul.