Carry out the following steps to create a custom object that is used to store country codes along with a custom field to mark whether the country is an embargoed nation:
- Click on the Setup gear icon in the top right-hand corner of the main Home page, as shown in the following screenshot:
- Click on Setup, as shown in the following screenshot:
- Navigate to the Object Manager setup page by clicking the following: Objects and Fields | Object Manager.
- Click on Create.
- Click on Custom Object, as shown in the following screenshot:
You will be presented with the New Custom Object edit page.
- Type Country Code in the field Label textbox.
- Type Country Codes in the field Plural Label textbox.
Upon clicking out of the field Label textbox, the Object Name changes to Country_Code.
- Optionally, enter details in the Description field.
- Leave the Context-Sensitive Help Setting set to Open the standard Salesforce.com Help & Training window.
- Leave the Enter Record Name Label and Format sections unchanged.
- Leave the settings in the Optional Features section unchanged.
- Leave the Object Classification section settings unchanged.
- Leave the Deployment Status set to Deployed.
- Leave the Search Status set to Allow Search.
- Leave the settings in the Object Creation Options section unchanged.
- Click on Save, as shown in the following screenshot:
Having created the Country Code custom object, we will create a custom field—IsEmbargo.
- Click on the Setup gear icon in the top right-hand corner of the main Home page, as shown in the following screenshot:
- Click the Setup option, as shown in the following screenshot:
- Navigate to the custom Country Code customization setup page by clicking the following:
Objects and Fields | Object Manager | Country Code | Fields and Relationships.
Locate the Fields & Relationships section on the right of the page.
- Click on New.
You will be presented with the Step 1. Choose the field type page.
- Choose Checkbox from the Data Type options.
- Click on Next.
You will be presented with the Step 2. Enter the details page.
- Type IsEmbargo in the Field Label textbox.
Accept the default IsEmbargo in the Name field.
- Optionally, enter details in the Description field.
- Optionally, enter details in the Help Text field.
- Click on Next, as shown in the following screenshot:
You will be presented with the Step 3. Establish field-level security page.
- Select the profiles to which you want to grant editing access to this field via field-level security. The field will be hidden from all profiles if you do not add it to field-level security.
- Click on Next.
You will be presented with the Step 4. Add to page layouts page.
- Select the page layouts that should be included in this field. The field will be added as the last field in the first two-column section of these page layouts. The field will not appear on any pages if you do not select a layout.
- Finally, click on Save.
You will now create the following test data in preparation for the How to do it... section.
- Enter the following data in the custom Country Code object:
-
- Create a Country Code record with COUNTRY CODE NAME set to ZW and ISEMBARGO set to True.
- Create a Country Code record with COUNTRY CODE NAME set to US and ISEMBARGO set to False.
- Create a Country Code record with COUNTRY CODE NAME set to GB and ISEMBARGO set to False.
The list view for the Country Codes will appear, as shown in the following screenshot: