You need to sign in to do that
Don't have an account?
Visual force internal error..help please!!!!
Below is my VF code and the controller code.
When i hit the command button i get this white page and it says AN INTERNAL ERROR HAS OCCURRED.
Can't figure out, why this is happening, help please!!!!
<apex:page controller="workOrderController">
<apex:form >
<apex:pageBlock mode="maindetail" >
<apex:pageBlockSection columns="1" title="Number of Orders Involved">
<apex:actionRegion >
<apex:outputText value="Number of Orders Involved:"/>
<apex:selectList value="{!involved}" size="1">
<apex:selectOption itemValue="0" itemLabel="0"/>
<apex:selectOption itemValue="1" itemLabel="1"/>
<apex:selectOption itemValue="2" itemLabel="2"/>
<apex:selectOption itemValue="3" itemLabel="3"/>
<apex:actionSupport event="onchange" reRender="selection" status="status5" />
</apex:selectList>
</apex:actionRegion>
</apex:pageBlockSection>
<apex:outputPanel id="selection">
<apex:pageBlockSection id="section1" rendered="{!involved==1||involved==2||involved==3}">
<apex:outputLabel value="Order 1:" for="orderNumber1"/>
<apex:inputText id="orderNumber1" value="{!orderNumber1}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="section2" rendered="{!involved==2||involved==3}">
<apex:outputLabel value="Order 2:" for="orderNumber2"/>
<apex:inputText id="orderNumber2" value="{!orderNumber2}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="section3" rendered="{!involved==3}" >
<apex:outputLabel value="Order 3: " for="orderNumber3"/>
<apex:inputText id="orderNumber3" value="{!orderNumber3}"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:pageBlockButtons >
<apex:commandButton action="{!displayCircuits}" value="Display Circuits"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Retrieved Circuit records">
<apex:dataList value="{!queryResult}" var="r">
<apex:outputText value="{!r.Id}" />
<apex:outputText value="{!r.Name}" />
</apex:dataList>
</apex:pageBlock>
</apex:form>
</apex:page>
public class workOrderController{
public Integer involved = 0;
public String orderNumber1{get{return orderNumber1;}set{orderNumber1 = value;}}
public String orderNumber2{get{return orderNumber2;}set{orderNumber2 = value;}}
public String orderNumber3{get{return orderNumber1;}set{orderNumber1 = value;}}
public List<Circuits__c> queryResult{get{return queryResult;} set{queryResult = value;}}
public Integer getInvolved(){
return this.involved;
}
public void setInvolved(Integer involved){
this.involved = involved;
}
public pageReference displayCircuits(){
String qryString = 'SELECT Id,Circuits__c.Name, Circuits__c.Circuit_ID__c'+
'FROM Circuits__c' +
'WHERE Order__r.Name =: ' + orderNumber1 + 'or' +
'Order__r.Name =: ' + orderNumber2 + 'or'+
'Order__r.Name =:' + orderNumber3;
queryResult = Database.query(qryString);
return null;
}
}
Can you post the error information that you get (there should be an "error number" or something like that?
Visualforce Error
An internal server error has occurred
This is the error i get. No specific error message.
Really? Thnat's the whole page? Internal server error pages usually specify a number that salesforce support can use to locate internal information about the internal error.
Yes, That's it. I don't know if it has to do with me working in the sandbox.
But do you see anything that could possibly be the culprit
I have created a test unit so i can deploy it to production and see if it is giving me the same error.
Which is below.
I get the errors ORD variable does not exist and
external entry point error for the
List <Circuits__c> queryResult = Database.query(qryString); line.
I'm not very proficient with apex and controllers. Hopefully you can help me.
@isTest
private c
static testMethod void taskDisplayWorkOrder() {
String ordNumber1 = 'ORD-10000';
lass WorkOrderTest {String ordNumber2 = 'ORD-10029';
String ordNumber3 = 'ORD-18967';
String qryString = 'SELECT Id,Circuits__c.Name, Circuits__c.Circuit_ID__c '+'FROM Circuits__c WHERE Order__r.Name =: ' + ordNumber1 + 'or '+ 'Order__r.Name =: ' + ordNumber2 + 'or ' +'Order__r.Name =: ' + ordNumber3 ;
List <Circuits__c> queryResult = Database.query(qryString);
System.debug(!queryResult.isEmpty());
}
}
Are you missing some spaces between the various pieces of the strings you are concatenating together to form the queries?
It looks that way in the above, but hard to tell.
No, that's the way it was copied, the only one i fixed was the spaces for the or. But it's still giving me the same error message.
My general approach to these problems is to remove sections of the page, see if it renders, and continue removing/adding elements back in until you find the bad segment.