You need to sign in to do that
Don't have an account?
Admin User 10568
Access Records with Object IDs
Hi,
I would like to Access Records with object IDs within a visualpage with a custom controller. The use case is: User hits button, renders the visualforce page and it renders data relating to the object they're on.
The current code doesn't require an object ID to render. It renders everything.
See page below:
<apex:page Controller="PriceListAscending" renderAs="pdf" showHeader="false" >
<apex:pageBlock >
<apex:pageBlockTable value="{!Events}" var="e" align="center" cellpadding="2" style="font-weight: bold">
<apex:column value="{!e.name} {!e.REPRO__Street__c} {!e.REPRO__City__c}" style= "text-align: center;"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!Events}" var="e" align="center" cellpadding="2" style="font-weight: bold">
<apex:column value="{! TODAY()}" style= "text-align: center;" />
</apex:pageBlockTable>
<apex:pageBlockTable value="{!Events}" var="e">
<apex:column >
<apex:pageBlockTable value="{!e.REPRO__Properties__r}" var="custom" align="center" cellpadding="2" border="2" style="font-weight: bold; text-align: center; ">
<apex:column value="{!custom.Property_Level__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.Price_List_Property_Name__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Type__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Bdr__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Bth__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Study__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Internal_Size__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__External_Size__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Car__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__List_Price__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Status__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
</apex:pageBlockTable>
</apex:column>
</apex:pageBlockTable>
Any help would be great. The trailhead examples do this with the standard controller.
I would like to Access Records with object IDs within a visualpage with a custom controller. The use case is: User hits button, renders the visualforce page and it renders data relating to the object they're on.
The current code doesn't require an object ID to render. It renders everything.
See page below:
<apex:page Controller="PriceListAscending" renderAs="pdf" showHeader="false" >
<apex:pageBlock >
<apex:pageBlockTable value="{!Events}" var="e" align="center" cellpadding="2" style="font-weight: bold">
<apex:column value="{!e.name} {!e.REPRO__Street__c} {!e.REPRO__City__c}" style= "text-align: center;"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!Events}" var="e" align="center" cellpadding="2" style="font-weight: bold">
<apex:column value="{! TODAY()}" style= "text-align: center;" />
</apex:pageBlockTable>
<apex:pageBlockTable value="{!Events}" var="e">
<apex:column >
<apex:pageBlockTable value="{!e.REPRO__Properties__r}" var="custom" align="center" cellpadding="2" border="2" style="font-weight: bold; text-align: center; ">
<apex:column value="{!custom.Property_Level__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.Price_List_Property_Name__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Type__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Bdr__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Bth__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Study__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Internal_Size__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__External_Size__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Car__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__List_Price__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
<apex:column value="{!custom.REPRO__Status__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />
</apex:pageBlockTable>
</apex:column>
</apex:pageBlockTable>
Any help would be great. The trailhead examples do this with the standard controller.
Hope you're well.
Thank you for your response.
The URL directs to an article about adding a button to an apex page.
I have now created a custom button on the object layout that displays a visual page. The issue I was having was in regards to controllers. It seems a visual page saved with a custom controller is not available as content for a custom button. Since, I have used the standard controller with a controller extension to achieve list ordering. This was available for use and the button renders the visual force page as anticipated.
Thanks again for your help. Apologies, it's likely my question wasn't well put.
All the best.
All Answers
Greetings!
Please find the sample code in the below thread for the reference:
https://salesforce.stackexchange.com/questions/154677/retrieve-and-display-records-of-a-custom-object-on-click-of-a-button
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
Hope you're well.
Thank you for your response.
The URL directs to an article about adding a button to an apex page.
I have now created a custom button on the object layout that displays a visual page. The issue I was having was in regards to controllers. It seems a visual page saved with a custom controller is not available as content for a custom button. Since, I have used the standard controller with a controller extension to achieve list ordering. This was available for use and the button renders the visual force page as anticipated.
Thanks again for your help. Apologies, it's likely my question wasn't well put.
All the best.