Salesforce - Developer - Custom Objects


// Salesforce - Developer - Custom Objects:

To Create a Custom Object:

1. From Setup, enter Objects in the Quick Find box, then select Objects under 
2. Click New Custom Object.
3. Enter the Label, Plural Label, and Description. The Object Name is automatically
   generated.  The object’s labels appear in the user interface, while the Object 
   Name is used in the API.
4. Under Object Creation Options, select Launch New Custom Tab Wizard.
5. Click Save.
6. On the New Custom Object Tab page, select the appropriate style for Tab Style.
7. Keep the defaults for the rest of the Tab Wizard, and click Save.

After you define a custom object, you can also:

1. Create a custom tab for the custom object, to display the object’s data

2. Build page layouts to control which fields users can view and edit when 
   entering data for the custom object record

3. Import custom object records

4. Create reports and dashboards to analyze custom object data

5. View, add, or remove the object’s field history, relationships, Chatter 
   feed tracking, custom links, search layouts, and object limits

6. Associate the custom object with other records and display the custom object 
   data in custom related lists

7. Track tasks and events for custom object records

To create a new field:

1. From Setup, click Create | Objects and click the object’s name.

2. In Custom Fields & Relationships, click New.

3. Select Picklist and click Next. In this case we don’t need a multi-select 
   picklist, because users should select only one value for the candidate’s 
   Prospect Rating.

4. Enter the Field Label, picklist values, Field Name, Description, and Help 
   Text as shown.

5. Click Next.

6. For this field we won’t worry about field-level security. By default all 
   user profiles can see the Prospect Rating field, which is what we want.

7. Click Next again.

8. Keep the default page layout selection. The field is added to the Candidate 
   object’s page layout, because we created the field on that object.

9. Click Save.

To Create a Help Page for a Custom Object:

We highly recommend that you create help pages for your custom objects. It's 
easy to provide useful information about your object by using a simple 
Visualforce page. Your users will thank you!  Let’s create a simple Visualforce 
help page to reference from your Candidate object.

1. From Setup, enter Pages in the Quick Find box, then select Pages.

2. Click New.

3. Enter a label for your page — for example, Job Candidate Help.

4. Enter a unique name for the page — for example, Job_Candidate_Help.

5. In the Visualforce Markup area, enter information about your custom object. 
   You might want to include dependencies, next steps, or other tips for using 
   the object.  See
   creating_custom_objects_fields for the code.

6. Now let’s reference the help page you just created from your Candidate object. 
   To do this, we’ll edit the Candidate object.
   a. In the Setup Quick Find box, type Object.
   b. Under Create, click Objects.
   c. Click Edit next to the Candidate object’s name.
   d. Select Open a window using a Visualforce page and choose the page you 
      creating_custom_objects_fields for the screenshot.
   e. Click Save.

When your users click the Help for this Page link on a candidate record, they’ll 
see the helpful information that you provided about the Candidate object.

To add values to a picklist:

Editing fields can involve changing a large number of records at once. If this 
process takes a long time, it might be queued. You’ll get an email when the 
process is complete.

1. In the Setup Quick Find box, type Object.

2. Under Create, click Object.

3. Click the Candidate object’s name.

4. Under Custom Fields & Relationships, click the Prospect Rating field name.

5. In the Picklist Values section, click New.

6. Type Manager Favorite in the text box.

7. Click Save.

Best Practices for Custom Objects and Fields;

Custom objects and fields shape your data! Here are a few tips for creating 
custom objects that enhance instead of clutter your organization’s records and 

1. Unique naming: Make object and field names and labels concise, specific, 
   and descriptive. And very importantly, unique. For example, if your 
   recruiting app’s Position object has a field named Skill Set, use something 
   like Candidate Skill Set on the Candidate object to describe applicants’ 

2. Thoughtful architecture: When adding fields to an object, what’s the 
   cleanest and most efficient way to capture data? For example, instead of a 
   long list of checkboxes to track the regions that currently have a 
   particular position open, use a picklist.

3. Default field values: Don’t assign default values to fields that are both 
   required and unique, as this can cause uniqueness errors.

4. Careful renaming: If you’ve renamed objects or fields, check that these 
   items reflect the new names:
   a. List view names
   b. Standard report names or descriptions that include the objects or fields
   c. Email templates that contain the object or field names
   d. Any other items you customized along with the renamed object or field — 
      custom fields, page layout, or record types.

5. Global data updates: Before changing a field type (for example from checkbox 
   to picklist), make sure the change makes sense for all records that have 
   that field.

6. Help for users: Add help text when defining new objects or fields. Help text 
   should describe exactly what the object or field is for.

When you create a custom field on an object, the New Custom Field wizard guides 
you through defining the type of field you choose. For example for a formula 
field you’re prompted to select the type of calculation and to define the 
fields, operators, and functions in your formula. Or for a percent field, 
specify the number of decimal places.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License