+ Start a Discussion
Silkcutz01Silkcutz01 

UPSERT --- UPSERT FAILED --- ERRORS : (INVALID_TYPE_ON_FIELD_IN_RECORD)

I have a screen with a number input field with scale 2. 
The input value is allocated to a number variable with scale 2. 
The input value is allocated to a sObject variable and then added to a collection.
I then fast insert the collection which includes populating a number field with scale 2. 

This works fine EXCEPT when i enter a flat number (e.g. 123.00). It displays it fine (with the two decimal places) which I display in as a variable in a screen. However, when it comes to insert it provides the following error message: 

"UPSERT --- UPSERT FAILED --- ERRORS : (INVALID_TYPE_ON_FIELD_IN_RECORD) Purchase Price: value not of required type: 123 --- for SFDC record with ID : null," 

It seems, it ignores the scale when coming to insert and this causes the insert to fail.

I have created a work-around; by embedding the variable into a formula with scale 2. BUT I've wasted a few hours tracing the root cause and the error does not appear logical. Am I missing something and has anyone else experienced this problem? 
logontokartiklogontokartik
Are you using <apex:inputFIeld> ? This should resolve your issue if you are using inputField.
Silkcutz01Silkcutz01
This is using Visual Workflow.