• beameup
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

I want to display on a visualforce page the standard related lists that come with a Contact.

So far I've succeeded with:

 

  <apex:relatedList subject="{!contact}" list="openactivities"/>
  <apex:relatedList subject="{!contact}" list="notesandattachments"/>

 But darned if I can figure out the list name of HTML Email Status or Activity History. Is there some way of ascertaining the Child Relationship name of a given standard related list? Because I assure you, 

 

 

  <apex:relatedList subject="{!contact}" list="activityhistory"/>
  <apex:relatedList subject="{!contact}" list="htmlemailstatus"/>

 does not work.

 

For unit testing VF pages, the way that I learned to instantiate a PageReference was this:

 

Custom_Object__c obj = new Custom_Object__c(Name = 'Test');
insert obj;

//Create a reference to the VF page
PageReference pageRef = Page.MyVFPage;
Test.setCurrentPageReference(pageRef);

//Create an instance of the controller extension and call a method.
CustomObjectExtension objExt = new CustomObjectExtension(new ApexPages.StandardController(obj));
objExt.theMethod();

//Assert the results.
etc etc.

 


I was looking at a forum posting yesterday and noticed this way of instantiation:

PageReference pageRef = new PageReference('/apex/MyVFPage?id='+obj.Id);
Test.setCurrentPage(pageRef);

 

I'm curious - In what situations would I use this second way instead of the first way?

Also - what's the difference between setCurrentPage and setCurrentPageReference?  The documentation is not clear.

Thanks
David