The idea is that I'm going to pass in the User ID in the URL of the page and then I'm going to query all of the items of a custom objects (SM_cast__c) that belong to that user on the VF page.

So I start with this at the top of the VF page:

<apex:page StandardController="User" Extensions="MonthlyForecastPageController">

With this code getting the ID in the controller:

SM = (User)controller.getRecord();

And I get this error when compiling the VF page:

Compilation error: common.apex.runtime.bytecode.BytecodeApexObjectType
cannot be cast to common.apex.runtime.impl.ApexType

So I decide to switch the VF page around and use the custom object.

<apex:page StandardController="SM_cast__c" Extensions="MonthlyForecastPageController">

With this in the controller code:

SM_ID = ApexPages.currentPage().getParameters().get('id');

and I get this error in the browser when I run the page:

Id value 005500000011TPK is not valid for the SM_cast__c standard controller

I don't do Salesforce programming on a daily basis, so I'm sure I'm missing something simple.



  • how are you calling this vf page? means from a button or from where?
    – Nitin
    Jan 15 '16 at 14:49
  • Currently I'm not. I'm just pasting the URL into the browser.
    – LeeFranke
    Jan 16 '16 at 15:45

The value which you are getting from the page as an ID(005500000011TPK) is of a user. And as you have defined your standard controller as "SM_cast__c". You can only pass a record of that custom object as the Id.

If your ask is to have a standard controller for the custom object and still pass the user Id i the url, you need to change the parameter variable on the URL to UserId or some other value instead of "Id".

Hope this answers your question.

  • Set VF page to use SM_cast__c as standardcontroller, pass in param as UserId, then changed code to getParameters().get('UserId') got it to work. Thanks!
    – LeeFranke
    Jan 15 '16 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.