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

Error In component (java.math.BigDecimal encountered)

Hi all;

I have a VF page, custom component and controller class.

In order to be easily understood I simplified those as below. You can simply copy and paste them.


<apex:component controller="MyClass">
  <apex:attribute name="content" type="Object" assignTo="{!content}" description=""/>



public with sharing class MyClass {
    Object content = null;

    public void setContent(Object obj) {
      this.content = obj;
    public Object getContent() {
      return this.content;

 VF Page:

<apex:page standardController="Opportunity">
    <c:aTest content="{!}"/>



These are work fine. But if I changed the content of the <c:aTest> component to a Double value as below 

<c:aTest content="{!Opportunity.amount}"/>


It gives me the following error.

"Unsupported type java.math.BigDecimal encountered."


This is the only error message I get. As I understood the data type 'Double' can't be stored in a variable of Object data type when the value is passed through a component. If so, this shouls be a bug of Salesforce.

Can anybody help me to solve this problem. Thank you.


Tryout this syntax given below :


           <c:testcomponent content="{!TEXT(Opportunity.amount)}"/>


Hope this helps.