How to Create a Custom Address Field in Salesforce

In this Salesforce tutorial, we will learn to Create a Custom Address Field in Salesforce. We will see the method of creating a custom Address Field in Salesforce Lightning and Salesforce Classic editions respectively.

While working as a Salesforce admin in an organization that uses Salesforce CRM as its primary CRM tool, I was assigned a task to create an additional field to store the address information of campaigns. Since the campaign object does not have any standard address field, I decided to add a custom address field.

Custom Address is a type of compound field that consists of multiple subfields of the address fields.

In the below steps, with a couple of examples, I will explain the method of creating a custom Address field in Salesforce Lightning and Classic respectively.

Considerations for Custom Address field

  • Once we have enabled the Custom Address field, it cannot be disabled.
  • The fields label in the Custom address cannot be edited.
  • Unlike the Standard fields, we can’t mark a Custom Address field required.
  • Ensure that the custom address field is appropriately related to the data model and object relationships.
  • Do not use the custom address fields if the standard address meets your requirements because standard fields are easier to integrate with certain features, and they are automatically included in features like mapping tools.
  • Make sure that the custom address field is appropriately related to the data model and object relationships

Custom Address Field

In Salesforce, the Custom Address field is a type of custom field that allows users to store address information within a record. This field is useful for various objects such as accounts, contacts, or custom objects where we need to add the address field.

Salesforce provides a default Address field type, but in many cases, we need an additional custom address field for specific requirements or if we are creating fields within a custom object.

Create a Custom Address Field in Salesforce Lightning

To create a Custom Address Field in Salesforce Lightning, log in to your Salesforce developer account and follow the steps.

1. Navigate to the Setup page of Lightning, and for that click on the settings icon that is on the upper right side of the screen.

Salesforce Lightning Create Custom Address Field to objects

2. To enable the Custom Address field, go to the Quick Find box, search then select User Interface.

Salesforce Create a Custom object field in Lightning

3. In the User Interface Setup window, scroll down to the Setup section, and enable the checkbox of Use Custom Address fields.

After enabling the fields click on the Save button.

Enable Custom Address field in Salesforce Lightning

4. Go back to the Setup page, and click on the Object Manager tab.

Salesforce Lightning enable custom Address field

5. In the Object Manager setup, select the object in which you have to create a custom address field.

In this example, I have selected the standard object Campaign to create a custom address field.

Create a Custom Address Field in Salesforce

6. In the setup window of an object, click on Fields and Relationships in the left sidebar.

Custom Address Field in Salesforce Lightning

7. In the Fields and Relationships window, click on the New button to create a new custom field.

Create New Address field in Salesforce Lightning

8. In this step, select the field Data type as Address, and to do that active radio button of Address data type and click on the Next button.

Create New Address field for object in Salesforce Lightning

9. In this step, enter the details for the new Address field. In the Field Label enter the relevant name related to the address field. For example, I have written the Campaign address as a Label.

As we click on Field Name, it will be auto-filled according to the entered Field Label.

Salesforce Lightning add a custom address field in object

10. To set up field-level security for this field, activate the check boxes of the profiles to give them access to this address field. After this click on the Next button.

In this example, I have activated the Visible checkbox to make this field available to all users.

Salesforce Lightning Create Custom Address Field

11. In this step, activate the Page Layout of the object to make this field visible on the page layout, and after this click on the Save button.

Create a Custom Address Field in Salesforce Lightning

As we click on the Save button, the custom address field will be created in the selected object.

To view the custom address field, navigate to the object that you have selected in the above steps. Since I have selected the Campaign object, I will open the Campaign object to check the address field.

When you open a record or create a new record in that object, you will see the custom address field in the form window as shown in the picture below.

Salesforce Create a Custom Address field in Lightning

In this way, we have successfully created a Custom Address Field in Salesforce Lightning with the help of the above steps.

Create a Custom Address Field in Salesforce Classic

To create a Custom Address Field in Salesforce Classic, log in and switch to Salesforce Classic then follow the below steps.

1. To create a custom address field, we first need to enable a custom address field and for that navigate to the setup page.

To navigate to the Setup page click on the Setup page that is on the upper right side of the screen.

Salesforce Classic create Custom Address field for object

2. Go to the Quick Find box, and search then select User Interface under the heading Customize.

Enable Custom Address field in Salesforce Classic

3. In the User Interface window, scroll down to the Setup section, enable the checkbox Use Custom Address fields, and click on the Save button.

Salesforce Classic Enable Custom Address field

4. After enabling the address field, go to the Setup page then in the Build section click on the Customize dropdown.

Add a custom address field to an Object

5. Click on the dropdown of the object to which you have to add a custom address field and from the options in the dropdown click Fields.

Salesforce Classic Create Address field for object

6. In this window, scroll down to the section Fields and Relation and click on the New button.

Salesforce Classic Create a Custom Address Field

7. In this step, enter the relevant label for the Image field in Field Label, and as we click on the Field Name it will be auto-filled according to the entered Field Label.

After entering the required fields click on the Save button.

Create a Custom Address Field in Salesforce Classic

8. In this window, we have to select profiles that can have access to this field and for that enable the checkboxes adjacent to the profile names.

To enable this field for all users, activate the visible checkbox and click on the Save button.

Create a new Custom Address Field in Salesforce Classic

9. In this step, activate the check box of the page layout to make this field visible on the Object Page layout then click on the Save button to apply changes.

Create a New Address field in Salesforce Classic

As we click on the Save button the custom address field will be created in the selected object.

In this example, I have created this custom address field in the Order object, and when I navigate to the order object in the application the created address field will be there as shown in the below picture.

Custom Address Field in Salesforce Classic

In this way, we have successfully created a Custom Address field in Salesforce Classic with the help of the above steps.

Conclusion

In this Salesforce tutorial, we have learned to enable the address field and then successfully created the Custom Address field for objects in Salesforce Lightning and Salesforce Classic edition respectively.

Along with this we also discussed Custom Address field utilization and the considerations that we should be aware of while using the Custom Address field in a Salesforce standard and custom objects.

You may like to read: