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
dietcoladietcola 

limit fields seen when creating new record

I have a field on one of my custom objects that auto-fills due to a Field Update/Workflow Rule.  Since the information for that field is filled in automatically for my user, I don't want the field to show up when they go to create a new record.  Is there a way to hide it?

 

As always, many thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae

My mistake, thought you could do that.

What you should be able to do is make that field read only on the layout.  It won't appear in the edit view and will be filled in (by your workflow) in the view detail view.

You can do this by editing the layout, go to that field and select the properties (the wrench) and check the read-only box.  This will only work if the field is not required.

All Answers

JimRaeJimRae
As long as it is not a required field, you could just take it off of the edit page layout, then they wouldn't see it.
dietcoladietcola
That sounds promising.  How do I edit the "Edit" page layout as opposed to the regular/default one?
JimRaeJimRae

My mistake, thought you could do that.

What you should be able to do is make that field read only on the layout.  It won't appear in the edit view and will be filled in (by your workflow) in the view detail view.

You can do this by editing the layout, go to that field and select the properties (the wrench) and check the read-only box.  This will only work if the field is not required.

This was selected as the best answer
dietcoladietcola

Hi, Jim-

 

That is a very good idea, and I'm not sure I would believe this if I wasn't the one looking at the screen, but marking the field Read-Only on the page layout doesn't actually seem to do anything.  After saving the page layout, I go back to the screen and try to edit the field, and it still lets me.  (Whatever I change it to is overwritten by my workflow rule once I click Save, but still, I would think that it wouldn't show up on the Edit page at all since it's a Read-Only.)

 

My only guess is that the Read-Only property is overruled by the fact that I have a workflow rule updating that field.  That's weird though, right?

 

(And the field isn't required.)

 

Thank you for your help so far!

JimRaeJimRae

My guess is that you have an administrator profile that has "edit read only" turned on.

What you should do, is preview the layout using the layout editor "Preview as..", and pick a regular user's profile type.

Then, when the preview opens you will see the field.  When you select the button for "Preview Edit Page"  you should see that the read only field is not visible.

dietcoladietcola

Beautiful!  You are right, and that did the trick.

 

Thank you so much for your help!