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
salesforcerrrsalesforcerrr 

Only StandardController and Apex Code controllers are currently supported

Hi,

I have build an page component with the following head: 
<apex:component layout="none" access="global" extensions="CaseImageController">
    <apex:attribute name="case" description="The Service Activity Statement." type="Case" />

Which i want to be able to use the following Controller extension:
 
Public Class CaseImageController {

    String recId;
    
    public CaseImageController (ApexPages.StandardController controller) {
        recId = controller.getId();    
    }
    
    public String getFileId() {
        String fileId = '';
        List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId order By LastModifiedDate DESC limit 1];
        if( attachedFiles != null && attachedFiles.size() > 0 ) {
            fileId = attachedFiles[0].Id;
        }
        return fileId;    
    }
}

 However, the error i am getting: 
Only StandardController and Apex Code controllers are currently supported

When I try to insert standarController="Case" in the first line of my componet I get the following error instead: 
Unsupported attribute standardcontroller in <apex:component> in ActivityStatement at line 1 column 106

Can somone assist witht this please? Much appreciated. 
PawanKumarPawanKumar
you can not pass Sobject directly so please try below code.

<apex:component layout="none" access="global" controller="CaseImageController">
    <apex:attribute name="recId" assignTo="{!recId}"/>
    
    
    Public Class CaseImageController {

    String recId{get;set;}
    
    public CaseImageController () {
    }
    
    public String getFileId() {
        String fileId = '';
        List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId order By LastModifiedDate DESC limit 1];
        if( attachedFiles != null && attachedFiles.size() > 0 ) {
            fileId = attachedFiles[0].Id;
        }
        return fileId;    
    }
}
    

Regards,
Pawan Kumar
PawanKumarPawanKumar
Change name="recId1" and try.
PawanKumarPawanKumar
is it working?
PawanKumarPawanKumar
i think you are getting this error because you have given Type="Case", please change this to String.

 <apex:attribute name="recId1" assignTo="{!recId}" description="The Service Activity Statement." type="String" />