Background
I am getting this error:
Invalid conversion from runtime type String to Double
On this line of code:
line.put(targetField, (Double)fieldValue);
The variable fieldValue
is of type String
and contains the value 4
The variable targetField
is of type String
and contains the value QUANTITY
The above code is trying to set of the value of 4
on the QUANTITY
field of the QuoteLineItem
object.
Questions
- Why is my cast not working in this
QuoteLineItem.QUANTITY
field? - How can I successfully cast the String?