function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rotvizrotviz 

Problem updating field with type Currency in an Sforce Control with javascript

Hi, my problem is:

the code is in javascript

.... //connect to the ActiveXObject

//the field Amount in salesforce is "Amount : EUR 58.240,00"

importe = sobj.Item('Amount').Value;

iva = parseFloat(importe) * 0.16;

sobj.Item('TAXn__c').Value = iva;

document.writeln("\nCuanto de Iva = "+sobj.Item('TAXn__c').value );    

miArray[0] = sobj;

results = sfdc.Update(miArray,false);

 

When the Sforce Control execute document.writeln("\nCuanto de Iva = "+sobj.Item('TAXn__c').value );

in the explorer windows appear Cuanto de Iva = 9318.4 ,this is the CORRECT VALUE

but when i reload the salesforce window in the field TAXn appear TAXn : EUR 931.840,00 and this is not the value that i want.

Thanks.

Best Regards.

DevAngelDevAngel

Hi rotviz,

Is this on an opportunity?  If so, which fields are you inspecting for the amount, Amount or Expected Revenue?

rotvizrotviz

Hi Dave,

 

yes , it´s in an opportunity and the field in the API of salesforce is "Amount".

I think the problem is that the type of the field "Amount" is Currency, and i'm putting a float type into a currency type.

Also i think that may be the problem is the format that salesforce use the "dot" and the "comma" in the currency type, because in a currency type when there are a thousend number use a dot, and when there are decimals numbers use comma, and in javascript when i write a number in the explorer windows appear in a different format, when there are a thousend number don´t use nothing, and when there are decimals numbers use "dot" .

Thanks.

Víctor �lvarez