function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Frances AllenFrances Allen 

Querying Payment from Opportunity - Relationship Fields

I want to show payment data on a visual force page. I cannot get this to work. I am thinking that I have correctly queried through a nested relationship statement and all is well, but this is not happening.  The visualforce page is here: 
   
<apex:page controller="TestRollUpData">
    <apex:form >
        <apex:pageBlock title="Tests" id="more_tests">
			<apex:pageBlockTable value="{! Opportunity }" var="o">
                <apex:column value="{! o.Name}"/>
                <apex:column value="{! o.Designated_Fiscal_Year__c}"/>
                <apex:column value="{! o.Amount}"/>
            </apex:pageBlockTable>
            <apex:pageBlockTable value="{! o.npe01__OppPayment__r }" var="x">
                <apex:column value="{! x.npe01__Payment_Date__c}"/>
            </apex:pageBlockTable>
            <apex:repeat value="{! Opportunity }" var="x">
              <script>
                  document.getElementById('totalRevenue').value =
                 parseFloat(document.getElementById('totalRevenue').value) + {! Opportunity.Amount};
              </script>
            </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

and the controller is here:
 
public class TestRollUpData {
    

   
    public List<Opportunity> getOpportunity(){ 
    
         List<Opportunity> tests = [SELECT Name, Amount, Designated_fiscal_year__c,
                                    (SELECT npe01__Payment_Date__c FROM  npe01__OppPayment__r ) FROM Opportunity 
            WHERE Designated_fiscal_year__c = '2020-2021' LIMIT 10];	
           
           return tests;
           
         }
    
    }

​Does anyone have any idea if this is because my npe01__OppPayment__r field is reference NPSP managed fields and is not standard Salesforce payment or is this just a bad query? I think theoretically this makes sense. Why will this not show on the page? The only error I'm getting is Unknown property 'TestRollUpData.o'. On my TestRollUpData page and controller.

Thanks.
 
Abdul KhatriAbdul Khatri
<apex:page controller="TestRollUpData">
    <apex:form >
        <apex:pageBlock title="Tests" id="more_tests">
			<apex:pageBlockTable value="{!Opportunity }" var="o">
                <apex:column value="{!o.Name}"/>
                <apex:column value="{!o.Designated_Fiscal_Year__c}"/>
                <apex:column value="{!o.Amount}"/>
            </apex:pageBlockTable>
            <apex:pageBlockTable value="{!o.npe01__OppPayment__r }" var="x">
                <apex:column value="{!x.npe01__Payment_Date__c}"/>
            </apex:pageBlockTable>
            <apex:repeat value="{!Opportunity }" var="x">
              <script>
                  document.getElementById('totalRevenue').value =
                 parseFloat(document.getElementById('totalRevenue').value) + {!Opportunity.Amount};
              </script>
            </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Can you try the above code in visualforce page? 
Frances AllenFrances Allen
This code works in my browser it just give me the error I listed above and won't show me the payment. 
Abdul KhatriAbdul Khatri
Have you shared the full code as I don't see 'totalRevenue' anywhere?
Abdul KhatriAbdul Khatri
<apex:page controller="TestRollUpData">
    <apex:form >
        <apex:pageBlock title="Tests" id="more_tests">
			<apex:pageBlockTable value="{!Opportunity }" var="o">
                <apex:column value="{!o.Name}"/>
                <apex:column value="{!o.Designated_Fiscal_Year__c}"/>
                <apex:column value="{!o.Amount}"/>
                <apex:column>
					<apex:facet name="header">Payment_Date</apex:facet>                    
                	<apex:repeat value="{!o.npe01__OppPayment__r}" var="x">
                		<apex:outputField value="{!x.npe01__Payment_Date__c}"/>
                	</apex:repeat>
                </apex:column>
            </apex:pageBlockTable>
          <apex:repeat value="{!Opportunity }" var="x">
          	<script>
            	document.getElementById('totalRevenue').value =
                parseFloat(document.getElementById('totalRevenue').value) + {!x.Amount};
          	</script>
          </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Please try this
Abdul KhatriAbdul Khatri
Any update?
Frances AllenFrances Allen
I haven't gotten this field to show on the visualforce page yet. This has been a problem for 5 months. I see that others are doing, but I'm not sure how. Even if I query through a relationship field, etc. Payment fields will not show.
Abdul KhatriAbdul Khatri
Can you check field access level to verify you access to the field?
Abdul KhatriAbdul Khatri
Can you please verify?
Frances AllenFrances Allen
I can read and edit the payment date fields, however, this is a managed package from the Non-profit success pack, which leads me to believe that we're probably not using the standard Salesforce payments fields.
Abdul KhatriAbdul Khatri
Can you look at the following solution, if it help you
 
https://developer.salesforce.com/forums/?id=9060G000000IA34QAG

 
Frances AllenFrances Allen
No, I can't even see these in the sandbox. I think this one's going on the  Non-profit Success pack mysteries of the ages list. We have to move on. I'm not able to develop this visualforce page.