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

How to hide fields based on "mode" detail/view or edit.

Hi, hopefully this is easy to do and I am just missing some information here.


We have a custom object that has a number of custom fields.

I have created a visual force page with some functionality for our web users for inserts and updates. 

The detail (or view) page only has some of the fields from the object (to reduce clutter).  The VF page has a lot more fields.



Custom object has fields A, B and C.

page layout for view (detail) displays fields A and B.

VF page for edits and inserts displays fields A, B and C.


Now we need the custom object displayed on mobile devices.  Since the sales force mobile app ignores the VF page as being the page for inserts and edits, we have had to add the additional fields to the view (detail) page so they will be available when someone wants to insert or update a record via the mobile app.



Now the page layout for view (detail)  has to display fields A and B and C so that C will be available in edit mode.


This really looks awful.  Is there some way to conditionally hide/show fields on the page layout (not VF, but the standard sales force page layout) based on the "mode" of the display?




Hi asapjim,

You seems to want certain fields to be displayed for "view /detail page" and  certain fields to be displayed for "Add/Edit" mode.

And from  your query one can deduce that you need it done via "Standard" Pages only and in standard pages the only way to show some fields in View mode while others in Add/Edit mode is through visibility --> for example if field "a" is set as readonly you will be able to see it in "View/Detail" page but in "Add/Edit" page.

Hence answer to your query would be that you have to have 3 fields on the "view/detail" page as you would want the user to enter these values too. Hence with standard page you cannot achieve this.


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