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
John L.John L. 

Problem using dynamicComponent tag

I have the following Apex tag:

 

   <apex:dynamicComponent componentValue="{!eT}"/>

 

that results in the following error when attempting a Quick Save:

 

   Error: Cannot convert the value of '{!eT}' to the expected type.

 

The pertinent controller class methods are as follows:

 

  public sObject super(String s) {
       EmailTemplate t = ooo

       return (sObject) t;
  }
  public sObject getET() {
       return super('{!tmpl.DeveloperName__c}');
  }  

 


The error occurs when the methods return either "sObject" or "EmailTemplate" object types.

 

Thanks in advance for any help you may be able to provide.

surasura
componentValue—which accepts the name of an Apex method that returns a dynamic component.

your method should return a value of type dynamic component 

refer this for an example https://www.salesforce.com/docs/developer/pages/Content/pages_compref_dynamicComponent.htm
                                   https://www.salesforce.com/docs/developer/pages/Content/pages_dynamic_vf_components_implementation.htm