+ Start a Discussion

Record Type ID as hidden field on site page

I need the recordtype id as a hidden field on a page being used on our "Site"

I was told that I needed an extention to add this to the page. So here is my CE. I've uploaded from the sandbox to my production, but when I attempt to deploy it, it fails... WHY!



public class CustExt {
    public CustExt(ApexPages.StandardController stdController) {}
    public string getRecId() {
        return CustomObject__c.RecordTypeID='0123000000101RCAAG';


What does the deploy failure log says????


Do you have a valid record id created in your production?


RecTypeID is valid (not the one I posted, as I altered in the post for obvious reasons) but the real one I'm using is valid...


As far as logs, I'm not sure where to find those, I looked under all options under monitoring, and don't see anything remotely close to a deployment log...  Where can I find that?


I found this under the inbound change set where it shows that it failed...  Is this what your are asking for...


Failure Message: "System.QueryException: List has no rows for assignment to
SObject", Failure Stack Trace: "Class.MyProfilePageController.testSave: line 78,
column 35 External entry point"


Average test coverage across all Apex Classes and Triggers is 46%, at least 75%
test coverage is required.


I dont know if you are using this class called MyProfilePageController which is auto created by SF when you enable sites.  Class.MyProfilePageController.testSave is throwing an error, so you may want to take a look at that class and modify it accordingly.


 // Modify the test to query for a portal user that exists in your org

And then try to deploy it.




I am the SF SystemAdmin, and I cannot edit the MyProfilePageController, so forgive me when I say.  What are you talking about!


And what does that class have to do with me attempting to deploy a controller extention, that has NO relationship to that.


And How can MyProfilePageController even exist if it is causing an error


Thats what your error message is saying...


This is a known issue in the past with my profile page controller, and i am not sure if it is still existing or not. Did you get a chance to talk to SF support?


It doens't matter to have a relation between what you are deploying and what is already existing in production. When you enable sites or portal, there are few pages and classes that get created automatically and if there is any problem with those test classes then this is the case, it just wont let you deploy new items.






Any updates???


OK. Salesforce corrected the source of the deployment issues, but now that I have the extenion deployed, I'm getting an error


ERROR: Read only property '[CustExt].RecId'


Now What is wrong!!!


Here is a snippet from the page


<apex:page standardController="CUSTOBJ__c" extensions="CUSTExt" showheader="false" sidebar="false" cache="true" expires="600">


            <apex:pageBlockSection title="" columns="1" collapsible="false">
                <apex:pageBlockSectionItem >
                    <apex:inputHidden rendered="false" value="{!RecId}"/>


Read only property '[CUSTExt].RecId'