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
OdedHarnivOdedHarniv 

Adding a VF to an Object's edit layout

Hello

 

I need some expert advice.

 

I have an object representing an Article; an Article has 4 Author fields which initially I made text fields.

But then cam the requirement to make these fields selectable from a picklist or lookup.

 

These lists are of course dynamic as more articles are added to the DB.

 

I thought of implementing Bob Buzzard's VF lookup (http://bobbuzzard.blogspot.com/2010/09/visualforce-lookup.html), but I then realized that a VF page cannot be added to an edit layout (only details).

 

I thought of using a Custom setting but I don't think this will help answer the requirement.

 

Any ideas how can I add an option to select from list or lookup on the edit layout?

 

Many thanks

 

Oded

Shashikant SharmaShashikant Sharma

It looks to me Your Author should be a Separate Object and Article should have a reference to it a Lookup field. This lookup field will appear in both in edit as well detail layout. So do this

 

1) Create a Object Author

2)Add four lookup fields in Acticle Object for Author

 

Please let me know if any Issue in it.

OdedHarnivOdedHarniv

Hi

 

I really wanted to avoid another object.

 

Do you think creating a link that opens a "lookup" window is a good alternative.

 

Oded

Shashikant SharmaShashikant Sharma

From where you will get options for Author , means you will need some options to select in lookup window. It will be bit helpful if you can just explain me a bit more about your req, then it will be easy for us to solve this issue

OdedHarnivOdedHarniv

The requirement I got was to allow choosing the Author from a list.

 

I thought to create a VF page that when opened the controller selects all the Articles from the database and collects the Authors making them available for picking.

 

This way if the author of a new article had already written something in the past his/her name will be in the list, if this is a new author the user will type in the name.

 

As I discovered I cannot show my page on the edit layout (where a new Article is created).

So I'm looking for alternatives before I turn to managing the Authors in an object, which I really prefer not to.

 

Thanks a lot

 

Oded

Shashikant SharmaShashikant Sharma

I got your req, You want to select author were author can be an existing author from a existing article. I think any VFP will lead you to this issue that it will not come in edit layout so only option you have is to have a lookup. Your steps should be like this

 

1) Create Author Object

2) Add Author lookup in Article

 

And even I will suggest this is a better approach as well as it is simple and entity based approach and this approach is scalable also. Lets assume two authors have same name in that case you just need to add address in lookup page to identify it. And as you are using salesforce native lookup that will save some time of VFP creation and you will get soe feature like filter lookup if you want to use.

 

OdedHarnivOdedHarniv

Thanks for the advice

 

 

Shashikant SharmaShashikant Sharma

I know you are still not convinced :) , you will try to achieve this without creating new object. In case you do achieve this without new object please let me know and if you do this with new object , please mark it as solution :)