You need to sign in to do that
Don't have an account?

VisualForce Output Array List - Error: Unknown property 'supDetail.Number'
Hi All,
I have an apex class which are generated by WSDL. I also have custom Controller which basically get all the support cases for particular customer and I store it in List<>. My question is how to show the output in VisualForce page.
I keep getting the error of: Error: Unknown property 'supDetail.Number'
Here is my apex generated from WSDL:
public class ArrayOfSupportCaseEntity {
public SupportCaseEntity[] SupportCaseEntity;
private String[] SupportCaseEntity_type_info = new String[]{'SupportCaseEntity','http://abc.com/','SupportCaseEntity','0','-1','true'};
private String[] apex_schema_type_info = new String[]{'http://abc.com/','true','false'};
private String[] field_order_type_info = new String[]{'SupportCaseEntity'};
}
public class SupportCaseEntity {
public String CaseNumber;
public String Description;
public String Model;
private String[] CaseNumber_type_info = new String[]{'Lfid','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Description_type_info = new String[]{'AuthCode','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Model_type_info = new String[]{'PartID','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
}
public class SupportCaseSoap {
public String endpoint_x = 'http://www.abc.com/SupportCase/SupportCase.asmx';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://abc.com/', SupportCase};
public SupportCase.ArrayOfSupportCaseEntity GetSupportCase(String customerNumber) {
SupportCase.GetSupportCase_element request_x = new SupportCase.GetSupportCase_element();
SupportCase.GetSupportCaseResponse_element response_x;
request_x.customerNumber= customerNumber;
here is my custom controller:
public class SupportCaseController
{
SupportCase.ArrayOfSupportCaseEntity supportEnt = new SupportCase.ArrayOfSupportCaseEntity();
public List<SupportCase.SupportCaseEntity> SupportCaseDetail
{
get
{
SupportCase.SupportCaseSoap sc = new SupportCase.SupportCaseSoap();
supportEnt = sc.GetSupportCase('Motorola');
List<SupportCase.SupportCaseEntity> supportCaseList = new List<SupportCase.SupportCaseEntity>();
supportCaseList.Add(supportCaseEnt.SupportCaseEntity[0]);
return supportCaseList;
}
private set;
}
}
And here is my VisualForce Page:
<apex:page controller="SupportCaseController" tabStyle="Cases">
<apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}" />
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable id="block" value="{!SupportCaseDetail}" var="supDetail">
<apex:outputText value="{!supDetail.Number}"></apex:outputText>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
getSupportCaseDetail() is declared to return a String in it's declaration. The VF tag requires a List structure. I'd imagine that you want:
public LIst<SupportCase.SupportCaseEntity> SupportCaseDetail
I have no idea if the fact that you're trying to return a List on the return statement instead of a String is causing your grief, etc. but this certainly doesn't look correct.
Also, what is "supportEnt" there for. I understand that you may have that defined in the SupportCase class, etc., but you're not using it here at all.
Best, Steve.
Hi,
Thanks for your quick response.
Sorry, it was a method with List<> type, but it still didn't recognize the property of the SupportCaseEntity.
Do you have an example of VF page that is getting the data from List<> type?
Or do you know what works in VF to show a list of data?
Do you mean to use CaseNumber instead of Number?
Jeremy
Yes, I meant how to output the property, in my case is Number, Description, Model. I have class on my apex code, called Support Case, and I also have Support Case Entity which include number, description and model.
Once I get this support case and store it in List<>, how can I show it in VF.
Maybe I misunderstand, but there is no property on SupportCaseEntity called Number. The property seems to be called CaseNumber, so if you change your Visualforce to refer to {!supDetail.CaseNumber}, it seems to me like it should work.
Jeremy
Hi Jeremy,
Sorry, that was mistype, it is CaseNumber and it didn't work.
Do have an example for this, I might missed something?
Maybe this is another mistype, but your method SupportCaseDetail should be called getSupportCaseDetail.
Let me know how that one goes.
Jeremy
No, I called it supportcasedetail because within that method, I specify the get and set, so do I need to have another get method?
However, i was trying to create another get method but it did the same thing. Am I called it correctly in my VF page?
Thanks.
What does this line refer to:
supportCaseList.Add(supportCaseEnt.SupportCaseEntity[0]);
I'm not seeing supportCaseEnt anywhere in your code.
Jeremy
Sorry...here is my complete controller:
Please make the changes to custom controller as below
public class SupportCaseController
{
SupportCase.ArrayOfSupportCaseEntity supportEnt = new SupportCase.ArrayOfSupportCaseEntity();
public List<SupportCase.SupportCaseEntity> getSupportCaseDetail
{
SupportCase.SupportCaseSoap sc = new SupportCase.SupportCaseSoap();
supportEnt = sc.GetSupportCase('Motorola');
List<SupportCase.SupportCaseEntity> supportCaseList = new List<SupportCase.SupportCaseEntity>();
supportCaseList.Add(supportCaseEnt.SupportCaseEntity[0]);
return supportCaseList;
}
// i removed the setter for supportCaseDetail
}
Was the issue you were into resolved?
Yes, it is resolved. Thanks for your help.