I'm experiencing an issue with a visualforce page I built that includes the apex:repeat statement. It works fine in my sandbox, but the exact same code does not work in my production. Any thoughts as to why this might be?

VF page

        <apex:pageBlock id="ShowButton" >
            <apex:pageBlockSection rendered="{!NoMessage}">
                <apex:outputText label="No Messages today...!" />
            <apex:pageBlockSection rendered="{!Message}" columns="1">
                <apex:repeat value="{!ListMessagage}" var="Alert">
                    <apex:outputText label=" " value="{!Alert.Message_Board__c}"/>
                <apex:repeat value="{!TimeBasedMesg}" var="Alert">
                    <apex:outputText label=" " value="{!Alert.Message_Board__c}"/>
                <apex:inputCheckbox onclick="ConfirmRead()" rendered="{!DisplayCheckbox}" id="ConfirmRead"/>        
                <apex:outputText rendered="{!DisplayCheckbox}" value="I have read and Understood the messages."/>
                <apex:commandButton rendered="{!DisplayButton}"  id="ButtonOK" value="Ok" action="{!OkayController}"/>            


            for(Alert_System__c TAlert : [select Message_Board__c,Type_of_Alert__c,Start_Date__c,End_Date__c from Alert_System__c where Message_For__c =: 'Instructor' and Active__c =: true]){
                if(TAlert.Type_of_Alert__c == 'Verified Alert'){
                }else if(TAlert.Type_of_Alert__c == 'Timed Alert' && TAlert.Start_Date__c >= system.today() && TAlert.Start_Date__c < TAlert.End_Date__c){
            if(ListMessagage.size()>0 || TimeBasedMesg.size()>0){
                Message = true;  
            }else if(ListMessagage.size() == 0 && TimeBasedMesg.size() == 0){
                NoMessage = true;
                DisplayCheckbox = true;
                DisplayButton = false;                

  • 1
    please post your code so that we can see what the repeat does to start with:) – Rao Jan 23 '14 at 18:34
  • Without seeing your code, are you sure you actually have elements that your repeat code is iterating over in production? – Michael Welburn Jan 23 '14 at 18:36
  • Its exactly same in sandbox and its working and its not working in production..I don't know why..Yes are elements..In production i am only sseing checkbox and this message..nothing else... <apex:inputCheckbox onclick="ConfirmRead()" rendered="{!DisplayCheckbox}" id="ConfirmRead"/> <apex:outputText rendered="{!DisplayCheckbox}" value="I have read and Understood the messages."/> – miku Jan 23 '14 at 18:41
  • Please help i have already spent 2-3 hours debugging this.. – miku Jan 23 '14 at 18:43
  • Also I am showing this data on force.com site..Can this be an issue..? – miku Jan 23 '14 at 19:01

On a Force.com Site, I usually check the following:

Click on the Public Access Settings button to go the Site's Guest Profile.

  1. Make sure that all of the Apex Classes are selected.
  2. Make sure that all of the Visualforce pages are selected.
  3. Make sure that the proper permissions are set for all objects.
  4. Make sure that the proper field level security is set for each field (sometimes this is missed).

Some other non profile based possibilities:

  1. Check organization wide defaults.
  2. Reference data. Sometimes reference data isn't set up in custom settings or reference objects.
  3. String values - Code makes a comparison to a String valid in one sandbox, but not another (ick). Possibly due to picklist differences.
  4. Data being operatred on. Sometimes you code checks for some condition that you have set up on the data you are testing with in the sandbox, and that condition isn't on the data you have in production. Missed req't or bug in code, perhaps.
  5. Static resources - CSS/JS change in sandbox doesn't make it to production causing differences to page.
  6. Some other declarative change such as workflow rule is different between sandbox and production.


  • You can use the Developer Console to try to get a better understanding of what's happening.

  • If you are in the Developer Console, make sure that you uncheck the 'Show My Current Logs Only' option under the Debug menu.

  • Sometimes with the Developer Console, the logs don't show up (not sure why -- it's not idle) and I have to close Developer Console and the open it again and they are there.

  • You can set a debug log for the Site Guest User, through Setup | Monitor | Logs | Debug Log. Enter into the Lookup the name you find under the 'Assigned Users' button from the Guest Profile you access from the 'Public Access Settings' button. Then hit Save. It should find the user.

  • You can use the site preview as admin.

  • You can go to the page directly in your org logged in as yourself (not via the site) by going to /apex/pageName.

  • Thanks.Field didn't have sufficient permissions...Thanks a lot..I just missed it...: – miku Jan 24 '14 at 6:18

instead of silently catching the error, you could output it to the page:

} catch (Exception e) {
  ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error: ' + e.getMessage())); 

or add system.debug statements to make sure that there is data to iterate over, like in the for loop etc. Then use the developer console or the test class to see the debug log.

By just looking at the code, my first thought is that the object may be there but there isn't any data populated in them, thus nothing to output. But adding system.debugs and handling the error will help narrow down what could be causing the issue.

  • I have doubled checked data is there in the object..as i am told you i am also seeing "I have read and Understood the messages." on VF only..but no Data and this is only visible when any record is there..if(ListMessagage.size()>0){ DisplayCheckbox = true; – miku Jan 23 '14 at 18:55
  • Also I am showing this data on force.com site..Can this be an issue..? – miku Jan 23 '14 at 19:00
  • potentially, if the users viewing the data dont have access to it or the site doesnt have access to the objects etc... hate permissions issue with sfdc :-) – SalesForceGirl Jan 23 '14 at 19:12
  • How to give permissions..?can you help. – miku Jan 23 '14 at 19:15
  • 1
    Go to Setup->Develop->Sites Click the site label Then public Access Settings and ensure the objects/fields you are trying to see are read/edit in that profile. – Ricky Hewitt Jan 23 '14 at 19:34

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.