2

The Visualforce page works fine when I preview it but when I add the VF page to a site it gives me the below error. I checked the public access settings and it looks fine. All the objects have CRED rights. I tried deleting all the changes that I made recently but still, the site shows it is down. Can you check my below code?

enter image description here

VF Code:

<apex:page controller="i2"  sidebar="false" lightningStylesheets="true" docType="html-5.0"  > 


<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="x-ua-compatible" content="ie=edge" />
        <title>SLDS ResponsiveDesign Visualforce Page in Salesforce Mobile</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <apex:slds />
    </head>
    <body>

        <div class="slds-scope">

            <style>
                .mystyle {

                color: black;
                font-size: 18px;
                font-weight: bold;
                }
                body .bPageBlock .pbBody .red .pbSubheader{
                background-color:#585858;

                }
                body .bPageBlock .pbBody .grey .pbSubheader{
                background-color:#585858;

                }
                body .bPageBlock .pbBody .grey .pbSubheader h3{
                color:#FFFFFF;

                }

                .grey
                {
                background-color:white;
                }

                .hideField input 
                {
                display: none !important;
                visibility: hidden !important;
                }

            </style>


            <apex:form id="theform" >

                <apex:pageBlock id="section1"  >

                    <apex:outputPanel id="errmsg">
                        <apex:pageMessages />
                    </apex:outputPanel>




                    <div class = "mystyle">
                        Cleaning Activities
                    </div>


                    <apex:outputPanel styleClass="grey" layout="block">
                        <apex:pageBlockSection title="Login" collapsible="false"> 
                            <apex:inputField value="{!cle.Password__c}">
                                <apex:actionSupport event="onchange" action="{!assignPassword}"  reRender="CleaningSection" />
                            </apex:inputField>
                        </apex:pageBlockSection>
                    </apex:outputPanel>




                    <div align = "center">
                        <apex:commandButton styleClass="slds-button slds-button--brand" value="Retrieve Cleaning Activities" action="{!retrieve}"  /> 
                    </div>


                    <apex:outputPanel id = "CleaningSection" styleClass="grey" layout="block">
                        <apex:pageBlockSection columns="2" title="Cleaning Activity" id="section1" collapsible="false">
                            <apex:inputField value="{!cle.Operation__c}" required="false"/>
                            <apex:inputField value="{!cle.Cleaning_Company__c}" html-disabled = "true" html-hidden = "hidden" styleClass="hideField" />
                            <apex:inputField value="{!cle.PTW_Number__c}"/> 
                             <apex:inputField value="{!cle.Water_Usage_in_litres__c}"/>
                            <apex:inputField value="{!cle.Date_of_Cleaning__c}"/>
                            <apex:inputField value="{!cle.Cleaning_End_Date__c}"/>
                            <apex:inputField value="{!cle.Dry_Cleaning__c}"/>
                            <apex:inputField value="{!cle.Full_Site_Cleaning__c}"/>
                            <apex:inputField value="{!cle.Specific_Size_Cleaned_kWp__c}"/> 
                            <apex:inputField value="{!cle.Status__c}"/>
                            <apex:inputField value="{!cle.URL_of_Photos_folder__c}"/>  <br/>
                            <apex:inputField value="{!cle.Start_Time__c}" type="time" /> 
                            <apex:inputField value="{!cle.End_Time__c}" type="time"/>
                            <apex:inputField value="{!cle.Number_of_Workers__c}"/>
                            <apex:inputField value="{!cle.Hours_to_Deduct__c}"/>


                        </apex:pageBlockSection> 
                    </apex:outputPanel>


                    <div align="center">
                        <apex:commandButton styleClass="slds-button slds-button--brand" value="Save Cleaning Activity" action="{!save1}"  >
                            <apex:param name="buttonId1" value="button1" assignTo="{!paramValue}"/>
                        </apex:commandButton>
                    </div>


                </apex:pageBlock>

                <apex:pageBlock id="section2">

                    <apex:outputPanel styleClass="grey" layout="block">
                        <apex:pageBlockSection columns="2" title="Permit to Work Number"  collapsible="false">
                            <apex:inputField value="{!ptw.PTW_Number1__c}" required="false" />
                            <apex:inputField value="{!ptw.Number_of_Workers__c}"/>
                            <apex:inputField value="{!ptw.Date__c}"/>
                            <apex:inputField value="{!ptw.Cleaning_Activity__c}" />
                        </apex:pageBlockSection> 
                    </apex:outputPanel>

                    <div align="center">
                        <apex:commandButton styleClass="slds-button slds-button--brand" value="Save Permit to Work Number" action="{!save1}" reRender="errmsg">

                            <apex:param name="buttonId2" value="button2" assignTo="{!paramValue}"/>
                        </apex:commandButton>

                        <apex:commandButton styleClass="slds-button slds-button--brand" value="Reset PTW" action="{!refresh}" />

                    </div>

                </apex:pageBlock>


                <apex:pageBlock > 
                    <apex:pageBlockSection >

                        <apex:pageBlockTable value="{!clelist}" var="a" id="tableBlock" style="width:130%" >
                            <apex:column headerValue="Ticket Number">
                                <apex:outputLink value="https://c.ap2.visual.force.com/apex/Record_detail_Vf_Page?id = {a.Cleaning_Activity__c}">{!a.Name}</apex:outputLink>
                            </apex:column>
                            <apex:column headerValue="Contractor" value="{!a.Cleaning_Company__c}"/>
                            <apex:column headerValue="# of Workers" value="{!a.Number_of_Workers__c}"/>
                            <apex:column headerValue="Start Date" value="{!a.Cleaning_Start_Date__c}"/>
                            <apex:column headerValue="End Date" value="{!a.Cleaning_End_Date__c}"/>
                            <apex:column headerValue="PTW Number" value="{!a.Permit_to_Work_Number__c}"/>
                        </apex:pageBlockTable> 

                    </apex:pageBlockSection>
                </apex:pageBlock> 



            </apex:form>   

        </div>
    </body>
</html>

Controller:

public class i2{
public Cleaning_Activity__c cle{get;set;}
public Permit_to_Work_Number__c ptw{get;set;}
public List<Cleaning_Activity__c> clelist{get;set;}
public String paramValue{get;set;}


//constructor to create a new record
public i2(){
    cle = new Cleaning_Activity__c();
    ptw = new Permit_to_Work_Number__c();  

}

public void refresh(){
    ptw = new Permit_to_Work_Number__c(); 
}

//Assigning password to Cleaning Company
/* public void assignPassword(){
      system.debug(cle.Password__c);
     if(cle.Password__c != null){
   cle.Cleaning_Company__c = cle.Password__c;
     }}*/

public void retrieve()
{
    if(cle.Password__c == 'pv' || cle.Password__c == 'sunsure')
    {
        clelist = [SELECT Name, Password__c, Cleaning_Company__c, Number_of_Workers__c, Cleaning_Start_Date__c, 
                Cleaning_End_Date__c, Permit_to_Work_Number__c,PTW_Number__c FROM Cleaning_Activity__c where Password__c =: cle.Password__c];
        system.debug(clelist);   
    }
    else if(cle.Password__c == NULL)
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please key in the password to retreive the details'));
    else
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Password is incorrect'));
}



public void save1(){  
    system.debug('paramValue ' + paramValue);
    if(paramValue == 'button2')
    {
        system.debug('Password is ' + cle.Password__c);
        if(cle.Password__c == 'pv' || cle.Password__c == 'sunsure') 
        {
            System.debug('I am here');
            upsert ptw;
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'PTW Inserted Successfully'));
            ptw = new Permit_to_Work_Number__c();
        }
        else
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Wrong Password'));
        }
    }
    else
    {

        if(cle.Password__c == 'pv' || cle.Password__c == 'sunsure')
        { 
            if(cle.Operation__c != NULL)
            {
                upsert cle;
                clelist = [SELECT Name, Password__c, Cleaning_Start_Date__c,
                            Cleaning_End_Date__c,Number_of_Workers__c,
                           Permit_to_Work_Number__c FROM Cleaning_Activity__c where Password__c =: cle.Password__c];
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Cleaning Activity Inserted Successfully'));
                system.debug(clelist);
                cle = new Cleaning_Activity__c();
            }
            else
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please input the Operation Name'));  
            }
        }
        else
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Wrong Password'));
        }
    }



}


  }
1
  • Sometimes you run into browser cache issues when testing external pages. If you feel all CRED permissions are correct and you have even gone to the effort to strip back code accessing data, I recommend you test the URL in an incognito browser window.
    – TSmith
    May 20, 2020 at 15:20

1 Answer 1

0

This screenshot shows a GACK Error Id response from Salesforce.

enter image description here

Basically, something went wrong internally and they just returned an error code that can be used to track the cause.

However, the only current official method to decode that error code is to contact Salesforce support via a case.

Please consider voting for the Salesforce Idea Provide a public reference of GACK general stack trace identifiers as a way to improve this situation in the future.

3
  • Thanks, Daniel. I enquired with SF on the error and they said that the GACK corresponds to a null pointer exception. How do I fix this? May 21, 2020 at 1:06
  • Did they provide any more context other than it being a null pointer exception? I'd now proceed with capturing an Apex debug log when the error occurs. That should show where the exception is occurring if it is originating in your code. May 21, 2020 at 19:08
  • 2
    I figured out the issue. A look up field was having a lookup filter and the lookup filter uses a field from another object. I just need to grant permission for the field and it worked. Salesforce support was late to reply but they eventually figured out as well. May 22, 2020 at 0:32

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.