Pages

Wednesday, 27 January 2016

Creating custom Fields

Creating custom fields in salesforcce

A field is like a custom Database column. Object field Store the data for our records. Salesforce by default provide few fields with salesforce standard objects  those are called standard fields. We cannot delete salesforce standard field. If we want we can change label name. The field created by us are called Custom field. We can delete custom field in salesforce.
Creating fields in salesforce
Path for creating field for standard objects
Setup ->Build -> Customize ->select object-> Click on field-> Go to the custom fields and relationships-> click on new button and create your custom field.
Path for creating field for Custom object
Setup->Build->create->object->select object-> Go to custom fields and relationship and create your field in custom object.
Important points About Custom fields
Changing the data type of existing custom field is possible but it may cause data loss.
Deleting a custom field removes both the data and field.
Custom field are stored for 15 days in recycle in after deletion.
If data is lost any list view based on the custom field will be deleted and assignment and escalation rules may be affected.
 

Creating a Custom Field in Salesforce.com, Step-by-Step


1. Click the “New” Custom Field button. The exact location of this button will vary, depending on the object you’re using. If you’re creating a custom field on a standard object, navigate to Build > Customize > [Object Name] > Fields and click “New.” If you’re using a custom field, navigate to Build > Create > Objects, scroll down to the Custom Fields section, and click “New.”
New Custom Field
Figure B1-1. Start the field creation process.

2. Select a field type.

Every field within Salesforce.com has an associated type. When you create your own custom field in Salesforce.com, you will need to define a field type. A field’s type (e.g., Number, Text, etc.) ensures that certain parameters and governing rules are enforced. It drives how users see and interact with the corresponding field. Salesforce.com provides a number of field types to choose from. The types available to you when you create a custom field are a subset of the full set of field types that exist in Salesforce.com; some types are only available via standard objects. Here’s a full list of field types for reference.
■ Note Relationship fields (Lookup, Master-Detail) have a more detailed creation process than the five-step process described in this section.

3. Configure the field attributes.

Each field that you create in Salesforce.com has certain attributes that need to be defined. There are obvious examples, such as Name and, in some cases, Length. Other attributes provide depth for fields and allow them to be used properly in a variety of scenarios. You will want to get familiar with these attributes before creating your own fields; they include:
  • Field Label: The name of your field that is displayed to users.
  • Field Name: The unique name of your field. Field Name is typically not shown to users,
    although it is possible to do so. Field Names can only contain alphanumeric characters and
    (nonconsecutive) underscores, must begin with a letter, and must end with a letter or number.
  • Description: The Description field is purely for reference, used to explain the purpose and/
    or context of the field you are creating. It is highly recommended that you always populate
    Description even if the reason you are adding a field seems obvious.
  • Help Text: The bubble text displayed to users upon hovering over a small question mark next
    to the field. Populating the Help Text field is not required and is most valuable when a user
    might have trouble understanding how to interact with or interpret a field.
  • Required: This Checkbox must have a legitimately formatted value present before a record
    can be created or saved.
  • Unique: By selecting the Unique Checkbox, you ensure that the field on a new or existing
    record cannot contain a value that matches that of the same field on another record. Unique
    can be configured to be case sensitive or case insensitive.
  • External ID: This Checkbox serves as a record identifier for a field in a system or application
    outside of Salesforce.com. External IDs have special behavior when corresponding records
    are imported, either via the standard import wizards or the Apex Data Loader. Note that the
    External ID by itself does not guarantee that the field values are unique in Salesforce.com—the
    unique attribute is a separate function.
  • Default Value: By setting the Default Value on a field, you can set an initial value on every
    record that is created. This value can be as straightforward as a string (“New”) or a number
    (“5”). However, it can also be a formula that uses Salesforce.
■ Note The attributes available for definition vary by field type. Certain attributes are only available when selecting a particular field type.

4. Set up field-level security.

Establish the permissions to your new field that should be granted to existing profiles. Once you have set the field type and configured the related attributes for your field, you will need to set the visibility of and access to the field across
the existing profiles. You have three options that can be applied. Table B1-1 is a matrix showing the Visible and Read-Only columns that you edit along with the CRUD (create, read, update, delete) equivalent of the corresponding combination.
Table B1-1. Potential Field-Level Security Settings
Potential Field-Level Security Settings
Keep in mind that field type (FLS) may or may not have a direct impact on a user’s experience. If a User does not have access to a particular record at all, full access via FLS does nothing to change that—the user still will not be able to see any of the fields on the record. Or she may be granted Read/Write access via FLS but a validation rule (these will be covered later in this book) may override that access and prevent her from editing the record. FLS, whether associated with a profile or a permission set, conveys the maximum access to a field that a user might have; the user might ultimately have less access based on other settings, but she will not have more access to the field than configured via FLS. Figure B1-2 is a look at the FLS settings page during custom field creation.
Setting the field-level security for your field
Figure B1-2. Setting the field-level security for your field

5. Add to page layouts.

The last step in the field creation process is only marginally helpful, and I’ll explain why. You are given the option to automatically add the field you are creating to any of the page layouts for the corresponding object. If you are creating a Lead field and four page layouts exist for Leads, you can add the Lead field to any of those four layouts at your discretion, as shown in Figure B1-3.
Setting your page layout options
Figure B1-3. Setting your page layout options
This sounds like a nice time-saver, doesn’t it? The problem is that you have no control over the field’s location within the page layout, just whether it is present or not. Fields added to page layouts through this means are always added as the bottom, left-most field in the first section on the page layout, as shown in Figure B1-4.
Appearance of a new field when added during the creation process
Figure B1-4. Appearance of a new field when added during the creation process
Except in the rare situation where you specifically want your field to appear in the bottom-left corner of the topmost
field section on your page layout, you will need to go into your layout and edit it to move the field to the desired
location. You may want to hold off on automatically adding a field to a page layout and just do it manually for two
reasons:
  • If you forget to update the corresponding page layout after creating it, your field will be in the wrong location.
  • You have to update the page layout anyway and you will have additional control if you handle adding the field and moving it all at once.
That’s it! You do want to spend some time thinking about your options before just breezing through the creation.
You can always change your field settings later, but it’s definitely easier to set up your field properly up front.
 

No comments:

Post a Comment