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
David Forder 15David Forder 15 

Probably a simple question but would really appreciate help :)

Hi all,

Each Account record on our system is allocated a "Range" type - this lists the products they carry in stock. eg On the Accounts Object we have a field called "Range__c" and for each relevant Range record we have many Products listed.

I would like to display on the Accounts page a list of the products that apply for that particular Accounts "Range__c" .. I guess a VF page added will do the job but no real idea how to create a vf page for the accounts detail page that will list the products filtered by that Accounts "Range__c"

Can anyone help me alter the code below (I do have the vf code for the range page) to allow it to be used on the Account page and filter for the field Range__c  .. appreciate any help at all :)

<apex:page standardcontroller="Range__c">
<apex:messages />
    <apex:sectionheader title="{!$ObjectType.Range__c.label} Detail" subtitle="{!Range__c.Name}"/>   
    <apex:form >
        <apex:pageblock mode="maindetail" title="{!$ObjectType.Range__c.label} Detail">
         
            <apex:outputpanel >
                <apex:pageblocksection title="Information" showheader="false" collapsible="false" columns="2">
                    <apex:outputfield value="{!Range__c.Name}"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
    </apex:form>
    <!-- **********   [Related Lists for Record Type : Master ]   **********  -->
    <apex:outputpanel >
        <apex:relatedlist list="Products__r" title="Products"/>
    </apex:outputpanel>
  
</apex:page>










 
Abilash Kosigi 8Abilash Kosigi 8

Hi David,
In my opinion, you need not edit the VF page related to Range__c.  If you need to display a related list of products that are applicable for a particular range which exists in Account record --- you need to create a new VF page (and apex) with custom related lists. Add that new VF page to the page layout of the Account Object which would suffice.

Hence, I advice not to edit the Range VF page.

Please let me know if my understanding of your requirement is clear.

Regards,
Abilash.
David Forder 15David Forder 15
Thanks for the feedback. I am still working through it - I may come back to you if I cant resolve though. Thanks again )