+ Start a Discussion

Hiding Fields?

When you choose the new button and a record is created and your in the edit screen, is there a way to hide fields that I don't  want populated at first?







use page layout to mark those fields as read only, that way they will not show up in edit layout. I guess this solves your problem. there are other ways like using Field level security etc.


you can search entire documentation of salesforce.com in one place very easily http://www.cloudgofer.com/?q=field+level+security


I just want the fields hidden on record creation. After the record has been created and I would like to be able to edit those previously hidden fields.  So I can't make them read only nor limit there visibility based on Permissions. I'm basically looking to do conditional display.


If (record.isnew(), field1.visible = false, field1.visible=true) Is there something like this I can do?







As per my understanding,

You want to hide some fields (Field_A,Field_B,Field_C) when user creates new records,

Also want to make same field editable when user try to edit record second time.[ ***** hiding some fields when new record  creation ]


We can achive this as below



1)Create two recordtype for custom object [R1 & R2 ] and two different pageLayout  corresponding to RecordType  PL_R1 & PL_R2


2)When you create new record its PageLayout will be PL_R1 without this fields Field_A,Field_B,Field_C


3)Define a Workflow on condition : Every Time record is created  , using a field Update action Change its RecordType to R2


4) Autometically PL_R2 get assigned to this record , on PL_R2 ----- include these Field_A,Field_B,Field_C [including edit access ]


5) Done :)



In this way you can use RecordType and PageLayout combination to solve the problem, If you need any more help to implement this solution , please  let me know 



Hope this will help you, If it works for you mark solution as accepted






As an alternative to Bala's solution, you could also do this quite easily with Visualforce.
Sample visualforce page:


As an alternative to Bala's solution, you could also do this quite easily with Visualforce.


Sample visualforce page:



<apex:page standardController="MyObject__c" showHeader="true" sidebar="true" tabStyle="MyObject__c">
    <apex:sectionHeader title="MyObject__c Edit" subtitle="New MyObject__c" />


        <apex:pageBlock title="MyObject__c Edit" mode="edit">

            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}"/>         

            <apex:pageBlockSection title="Information" columns="2" >
                <apex:inputField value="{!MyObject__c.Field1__c}" required="true" />
                <apex:inputField value="{!MyObject__c.Field2__c}" required="true" />
                <apex:inputField value="{!MyObject__c.Field3__c}" required="true" />




Replace MyObject__c with your object, Fieldx__c with the fields you want to show (add more as needed).


Once you've created the visualforce page, go to your custom object in Setup and override the New button with this page.