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
vasvas 

how to add related lists to event page? or tie up certain record types to use visualforce pages?

The fundamental problem I'm struggling with is that Force.com platform doesn't allow adding a lookup field related to Event/Task on a custom object or vice versa. I need to have a related list section on Event page and display the records of a related custom object, so I've been playing with this idea-

- Create a text field to represent Event ID, in my custom object. Manage the relationship with Event through this field in custom controller/extension classe.

- Create a visualforce page mimicking all the functionality of the standard Event page and then add a pageBlock for the related list. I need to create pages for both edit and view functions. I'm assuming this is doable, although very painful. Pls point out if I'm wrong with this whole idea. 

 

Assuming it works out as planned, here's a problem I see already- I can have a button (say on Opportunity page/Open Activities section) to open a new Event in my visualforce page in edit mode and have the record created. Once a record is created, it will show up in the list in "Open Activities" section. Now if I click on this record or the Edit link next to it, the record is not going to open in my visualforce page. It will probably open up in the native page layout thats associated with the record type... that doesn't serve the purpose. 

I don't want to override the standard buttons/links because I have a bunch of other record types that use different native page layouts. Is it possible to tie up certain record types to always use my visualforce page, i.e., override the standard buttons/links based on record types? If not, what other options I have?

 

Any help is much appreciated. Thanks in advance.

 

Vas

Best Answer chosen by Admin (Salesforce Developers) 
vasvas

Ah.. that looks like a solution to my problem. I'm dreading already thinking about building all those visualpages. Wish there was an easier way to mimic and extend the standard page layouts.

 

Thanks, Jeff. Cool blog you got there.

All Answers

jeffdonthemicjeffdonthemic

Vas,

 

I have some sample code on a my blog that should help you redirect users to Visualforce pages based upon record types.

 

http://blog.jeffdouglas.com/2008/11/14/redirecting-users-to-different-visualforce-pages/

 

Good luck!

 

Jeff Douglas

http://blog.jeffdouglas.com

Informa Plc

vasvas

Ah.. that looks like a solution to my problem. I'm dreading already thinking about building all those visualpages. Wish there was an easier way to mimic and extend the standard page layouts.

 

Thanks, Jeff. Cool blog you got there.

This was selected as the best answer
jeffdonthemicjeffdonthemic

I had the same thought also as we have hundreds of page layouts. Since I'm essentially lazy, I wrote a small ASP.NET/C# application that will spit out a page layout as a Visualforce page.

 

Let me know if you are interested and I'll post the code for download.

 

Have a great day.

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

TehNrdTehNrd

Hey Jeff,

 

I can see that being a very useful tool for the dev community if you don't mind sharing.

jeffdonthemicjeffdonthemic

OK... you twisted my arm. I posted the code on my blog that shows how to generate Visualforce code for an existing Page Layout. 

 

http://blog.jeffdouglas.com/2009/02/09/generate-a-visualforce-page-from-an-existing-page-layout/

 

Good luck and let me know if you have any questions, comments or rants.

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com