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
Sara RSara R 

view all cases with emails

Hi,

I need a button or link that would be on the contact page and show me all of that contact's Cases and related emails. Anyone have such a thing?

Thanks!

TheSwamiTheSwami

 

You could create a page like this and call it "ContactInfo":

<apex:page standardController="Contact">
  <apex:relatedList subject="{!Contact.id}" list="ActivityHistories"/>
  <apex:relatedList subject="{!Contact.id}" list="Cases"/>
</apex:page>

 

Then open the page with the url /apex/ContactInfo?id=<id of Contact> 

(if you create a custom button on the Contact page, it will automatically add the id)

Sara RSara R

Thanks for your help!

 

I tried creating this page and it worked properly but what I had in mind was the full details of each case and case email in one window, similar to what is displayed when you click the View All in Activity History from a contact page. Can anyone help with that? Thanks :)

 

TheSwamiTheSwami

Oh, ok.  You would have to create some custom visualforce/apex to do that.

 

In the Apex controller, you would query for the records that you want to display.

In VF, you would use apex:repeat and pageBlockTable to create the list of all the activity records.