0

although I am quite new to Salesforce, I searched whole net if something would help me but doesn't seem so.

I have some VFPage:

<apex:page id="newOrderPage" controller="opportunityList2Con" tabStyle="Opportunity" >
<apex:pageBlock title="Set up a new order">
    <apex:form >
        <apex:datalist value="{! Opportunities }" var="opp" type="1">               
            <apex:outputField value="{! opp.AccountId }"/>
            <apex:inputField value="{! opp.Order__r.Payment__c }" />
        </apex:datalist>    
    </apex:form>
</apex:pageBlock> 

And a custom controller:

    public class opportunityList2Con {
    // ApexPages.StandardSetController must be instantiated
    // for standard list controllers
    public ApexPages.StandardSetController oppCon {
        get {
            if(oppCon == null) {
                oppCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Order__r.Payment__c, Order__r.AccountId

                     FROM Opportunity]
                ));
            }
            return oppCon;
        }
        set;
    }

    // Initialize oppCon and return a list of records
    public List<Opportunity> getOpportunities() {
        return (List<Opportunity>) oppCon.getRecords();
    }
}

This one is from the net, I wrote several others by myself but the issue is still the same. Input fields, Output fields not even just {! expression } is showing up. Everything works perfectly when I put standard controller Order or Opportunity in there, but since I start using any custom one, everything I had is just not there.

I have SysAdmin rights.

Thank you for any feedback.

1

You're missing a closing tag for the VF page. This is what your code should look like, I've gone ahead and added the closing tag, this is the likely reason your code isn't working.

You also shouldn't add a space {! opp.AccountId} as it will not call the Account ID on the opportunity, I've also amended this on your code wherever you shouldn't have spaces.

<apex:page id="newOrderPage" controller="opportunityList2Con" tabStyle="Opportunity">
    <apex:pageBlock title="Set up a new order">
        <apex:form>
            <apex:datalist value="{!Opportunities}" var="opp" type="1">               
                <apex:outputField value="{!opp.AccountId}"/>
                <apex:inputField value="{!opp.Order__r.Payment__c}"/>
            </apex:datalist>    
        </apex:form>
    </apex:pageBlock>
</apex:page>
  • Thank you alot. But the problem was not actually in VFpage's ending (I had that, just failed to copy in here), but with tables. dataTable, pageBlockTable, none of it worked, but then I saw your dataList. And that one worked. – user65177 Mar 3 at 8:47
  • Great, I'm glad I could help, happy coding! – Harry Smith Mar 4 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy