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
sandeep reddy 37sandeep reddy 37 

how can we create field

i have first name last name field both field display on same line in page lay out 
prabhat jhaprabhat jha
hi sandeep just goto your objects ,in the relatedlist it will show you custom field and relationships,click on new then choose the type of field ,as i can see name is a text field select text then move to next page,it will ask you to which profile you want to show this field and other things,while putting field name,give the name 1st name ,lastname so that user will see this so that they will provide first nmae and last name,
hope this answer is useful........
sandeep reddy 37sandeep reddy 37
i dont get it i am  asking about both text fields will come in same field  
prabhat jhaprabhat jha
use formula field and give it api name(Name) ,mention its return type (text) ,and in formula (firstname+ lastname),i think it should match your requirement....
 
sandeep reddy 37sandeep reddy 37
thanks for told me but dnot display the first &last name on page layout   
prabhat jhaprabhat jha
go to any record of that objecct ,you will see an edit layout link,click there you can drag and drop the fields you require ,and save that layout...
if it solved your answer mark it as solved and best answer......
jyothsna reddy 5jyothsna reddy 5
Hi Sandeep,

Concatenate 2 fields and then set this as a value of different field.Using "formula" field you can acheive this .
For example:
Formula field type :Text
Formula:  LastName & ", " & FirstName

Hope this answer is useful.

Regards,
Jyothsna D​
sandeep reddy 37sandeep reddy 37
i dont  want like this after enter edit page will not see the again  first name and last name  only full name want to see in page layout  i hope u underastand so please 
jyothsna reddy 5jyothsna reddy 5
Hi Sandeep,

It is not possible through pagelayouts. It can be possible through Visual force page and Apex. You can use Rendered to hide "FirstName " and "LastName" fields after clicking the save button.

Please try this below sample code
Visual Force Page:
<apex:page controller="CustomerDetails">
<apex:form >
<apex:sectionHeader title="Customers"/>
<apex:pageBlock title="Customer Details">

<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection rendered="{!showfields}">

<apex:inputField value="{!c.FirstName__c}"/>
<apex:inputField value="{!c.Name}"/>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!showfield}">

<apex:outputText value="{!fullname}" label="FullName"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller:
public with sharing class CustomerDetails {

    public String fullname { get; set; }

    public boolean showfields { get; set; }
    
    public Customer__c c { get; set; }

    public Boolean showfield { get; set; }
    
    public CustomerDetails (){
    c=new customer__c();
       showfield=false;
       showfields =true;
    }

    public PageReference save() {
     showfield=true;
     showfields =false;
    
    insert c;
    
    List<customer__c> customlst=[select id,Name,Full_Name__c from customer__c where id=:c.id];
    for(customer__c c1:customlst)
    {
      
       fullname=c1.full_name__c;
    }
       
   return null;
    }
}

Regards,
Jyothsna D