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
DNLZDNLZ 

Display events from "child" record on Master record

Hi,

 

I've got 2 custom objects(let's assume they are named A and B) in my developer org. They are "linked" to each other via a lookup relationship and the thing I want to achieve is as follows:

 

B has a lookup to A so A has a related list of B objects. The thing I want to do now is display all the tasks and events that are scheduled on B on a "custom related list" on the A object.

 

I'm assuming that I can pull this off with some visualforce with a controller extension. But the question is how, and is this possible ?

 

I can break this down in 5 easy steps.

 

  1. Get all the B objects that are associated with A.
  2. In turn loop trough the B objects and get all their events and tasks.
  3. Store the events/tasks in some kind of array.
  4. Supply the array to a apex detail page / related list like element.
  5. Am I on the right track with this?

 

Thanks,

Daniël

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

1) Make a Visualforce page and has object ‘A’ as standard controller and have extensions equal to your class name in which you bring the task and event of B object.

2) Customize the Visualforce page same as look and feel of related list

3) On object ‘A’ Edit the Page Layout and add the Visualforce page from Visualforce Pages section.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

1) Make a Visualforce page and has object ‘A’ as standard controller and have extensions equal to your class name in which you bring the task and event of B object.

2) Customize the Visualforce page same as look and feel of related list

3) On object ‘A’ Edit the Page Layout and add the Visualforce page from Visualforce Pages section.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
DNLZDNLZ

So it would look something like this:

 

<apex:page standardController="Opportunity" extension="getActivities>

</apex:page>

 

Then i would have an Apex class named "getActivities" with some methods that will create the list filled with tasks and events right ?