You need to sign in to do that
Don't have an account?
JAW99
Adding custom objects tabs to Tabbed Account
I followed this demo but can't list custom objects in the tabs.
If my custom object is "Transfer Station" and is child to Account in Master - Detail relationship, how do I code this?
I was able to figure out Closed Activities, Contracts, on my own, but beyond that, no custom object.
Those work. How would Transfer Station get in there? Thanks in advance!
If my custom object is "Transfer Station" and is child to Account in Master - Detail relationship, how do I code this?
I was able to figure out Closed Activities, Contracts, on my own, but beyond that, no custom object.
Code:
<apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct"> <apex:relatedList subject="{!account}" list="OpenActivities" /> </apex:tab> <apex:tab label="Closed Activities" name="ActivityHistories" id="tabClosdAct"> <apex:relatedList subject="{!account}" list="ActivityHistories" /> </apex:tab>
Interestingly, I have some custom objects who don't have this long ID string relating them, but instead I relate it with just "Customobject__r" (example below).
I'm curious why this is so. Any ideas?
I noticed that putting tabs in for custom related lists that users don't normally see in their layout stops the loading of the VF page at that list.
I can't see how I'd use this tabbing then. It would be great b/c our acct page is fairly long, and there's up to 15 related lists.
I checked it all again and did a test or two. The user has read and edit permission for the object, but if the list is not on the assigned page layout, the VF page will not load, giving:
"(related list id) is not a valid child relationship name for entity Account
It leaves me lost for use of tabbed account page. Maybe it's possible to customize the VF page based on profile...?
You could test this quickly by setting the rendered flag to false on the tabs that your test user doesn't have visibility to and see if the whole page loads.
I'll have to check it out further to make sure I'm getting the whole picture.
Alas, my apex explorer is acting up and I can't get back in to find out other ids, custom, or Account History... argh!
Not Activity History, I got the completed activities in there. I mean the account field history. I'd like to get that in.
I'm having the same problem that you have had in the past but unfortunately what you have done doesn't seem to be working for me. I have a custom object Back_Office_Patient__c with a child object Medical_Record__c. When creating a VF page I can't get the Medical_Record__r to show up, instead receiving the typical error message you have seen: 'Medical_Record__r' is not a valid child relationship name for entity Back Office Patient. I have tried to put other standard related lists in and have some luck ("ActivityHistories" and "Open Activities" work) but not entirely ("Histories", "Events", "Tasks" don't work). My other child relationship doesn't work either. I downloaded the Enterprise WSDL and looked through the Back_Office_Patient__c section for all the elements of type "QueryResult" (based on suggestion from another thread). Neither of my Child Relationships exist in this section but all the standard objects that both work AND don't work are in there!
Additionally, I reviewed my salesforce schema via Apex Explorer and I see the child object. It says "Child Object: Medical_Record__c" (which of course doesn't work). It also has a relationship name: [what looks like a GUID] but I can't copy and paste it. I wrote it down and am confident I did it correctly but that ID did not work either. my syntax is:
This works:
<apex:relatedList list="NotesandAttachments" id="b"> </apex:relatedList>
These do not work:
<apex:relatedList list="Medical_Record__r" id="b"> </apex:relatedList>
<apex:relatedList list="Medical_Record__c" id="b"> </apex:relatedList>
<apex:relatedList list="R00N40000001|znqEAA" id="b"> </apex:relatedList>
I'm completely out of ideas at this time. Any thoughts?
Thanks
Eric
Message Edited by CTU007 on 12-31-2008 06:15 AM
My code is below.
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:relatedList subject="{!account}" list="Contacts" />
</apex:tab>
Message Edited by biggieB on 01-18-2009 04:55 PM
Hi folks,
I ran into same issue regarding "Contacts" related list. If you have person accounts enabled and the record is of type person account then this related list will not work. I believe it only works where you have business accounts. In order to link contacts to Person accounts what I did was create a master detail relationship on the contacts object and called it "Member Contacts" then added a Member_Contacts__R related list.
As for Account History .... I still cannot get that to pull in as a related list. I've tried List="Histories" which is not working.
This works for me to add a link to the account field history:
<apex:tab label="Field History" name="Field History" id="fieldhistory" rendered="{!$Profile.Id!='00exxxxxxxxx'}" >
<apex:outputLink value="https://ssl.salesforce.com/_ui/common/history/ui/EntityHistoryFilterPage?id={!account.id}">
click to view field history
</apex:outputLink>
</apex:tab>
Not optimum as user has to click the link but you dont need to do a lot of work.
CTU007's link idea does work well. I also figured out how to access the Account History data. It is NOT a related list. Instead, use the code <apex:dataTable> to pull from the account.histories table. Below is rough code that will pull the Account History into a separate tab. The HTML formating is not very clean, but the data query works!:
<apex:tab label="Field History" name="Account History" id="fieldhistory" >
<apex:dataTable value="{!account.histories}" var="accounthistory" id="HistTable" rowClasses="odd,even"
styleClass="tableClass" cellspacing="15" width="80%">
<apex:facet name="caption"></apex:facet>
<apex:facet name="header">Field History</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:column>
<apex:facet name="header">Edit Date</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:outputText value="{0,date,MM/dd/yyyy HH:mm }">
<apex:param value="{!accounthistory.createddate}" />
</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name="header">Field</apex:facet>
<apex:facet name="footer"></apex:facet>
<b> <apex:outputText value="{!accounthistory.field}"/></b>
</apex:column>
<apex:column>
<apex:facet name="header">Edited By</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:outputText value="{!accounthistory.createdby.name}"/>
</apex:column>
<apex:column>
<apex:facet name="header">Old Value</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:outputText value="{!accounthistory.oldvalue}"/>
</apex:column>
<apex:column>
<apex:facet name="header">New Value</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:outputText value="{!accounthistory.newvalue}"/>
</apex:column>
</apex:dataTable>
</apex:tab>