How to Make Geolocation Field Required in Salesforce

The Salesforce geolocation field permits the user to identify the location by their latitude and longitude to calculate the distance between the locations. Here we make the geolocation field required.

This makes sure that the user must populate this field with the valid value before saving the record.

In this Salesforce tutorial, we will learn how to make the geolocation field required geolocation field in Salesforce.

For learning this process you have come to the right place and we learned this topic in both the editions of Salesforce Lightning and Salesforce Classic.

How to make the geolocation field required in Salesforce Lightning

Here we will learn how to make the geolocation field required in Salesforce lightning. So let us take an example, Suppose there is a company that uses the salesforce that manage its field service operation. The company dispatches service technicians to various customer locations to perform maintenance tasks.

The company wants to make sure that the geolocation of every service call is accurately recorded for reporting purposes and analysis purposes. Here we make the geolocation required and make sure that the technician inputs the exact coordinates of the customer location before closing the service call.

Here are the following steps:

1. Our lightning version is open when we click on the salesforce lightning account, and then click on the setup option that is present under the gear icon. After that select the object manager tab that is present under the setup page on the nav bar.

2. We want to select the service object from the nav bar, so enter the service in the search box and then select the service object. Here we can see the details related to the object.

We can see the Fields and Relationships option present on the left side of the page. Click on the Fields and Relationship option.

How to make the geolocation field required in Salesforce

3. There is a detail related to the object that is present on the right side of the object page. But we want to select the field and relationship, so click on the field and relationship option. After clicking on the field and relationship, the Fields and Relationships page is open.

4. Under this page, there are lots of fields created. But we want to create a new field. So for this, we click on the new button. The new data type page is open. Under this page, you can see that lots of data types are present. Here we select the geolocation data type.

5. The service’s new custom field page is open. Now enter the details, first fill the field label as Location and then select the latitude and longitude display notation and then fill in the Decimal Places as 6.

6. After that, fill the field name by simply clicking on the field, and the field name is automatically filled, then fill the description if you want to fill otherwise leave the field the same.

7. After that scroll to the bottom of the page, there is a general options section and under this section, there is a required checkbox is present. Click on the checked required checkbox field, this field always requires a value in this field in order to save a record. 

See also  How to Set Default Value for Percentage Field in Salesforce

8. Here we make the geolocation relationship field, so that is why we click on the required checkbox and click on the save button.

How to make the geolocation field required in Salesforce Lightning

9. Now we move to our next step which is to establish field-level security that can select the profiles to which we want to grant edit access to this field via field-level security.

The field will be hidden from all the profiles if we do not add it to field-level security and then click on the next button.

Make the geolocation field required in Salesforce

10. Now add this field to the page layout. Select the page layouts that should involve this field. This field will be added as the last field in the first 2-column section of these page layouts.

11. The field will not appear on any pages if we do not select a layout. To change the location of this field on the page, we will need to customize the page layout and then click on the save button.

Make the geolocation field required in Salesforce Lightning

12. Now we come back to our field and relationship page and under this page we can see our location field with geolocation data type is created successfully. When we click on this field our location field page is open.

13. Scroll to the bottom of the page and under the general options section we can see that the required checkbox is also checked. So this required field always requires a value in this field in order to save a record.

Salesforce make the geolocation field required

14. Click on the App Launcher, and enter the sales in the search box. The sales come at the top, click on the sales option. The Sales page is open. Under this Sales page, there are lots of objects present on the nav bar and we are selecting one of the objects.

12. Here we are selecting the service object. The service record page is opened. Under this page, we can see service record is saved. If you want to create a new record, click on the new button. The new service dialogue box is open. Here we can fill in the information related to the service.

13. Here we can fill the service name and then fill in the service location first fill the latitude and then fill the longitude this field is the geolocation field.

14. This location is the required field if we leave this filled empty it shows the error. So don’t leave this field blank fill in this location field which is a required field after filling the location and clicking on the save button.

Salesforce Lightning make the geolocation field required

15. It does not show any error it shows your record is created and our Sales Service record has been created the details related to the sales service are shown and our location field is also shown under the detail section.

16. After filling the information related to the service object, our service record sales service is created and our sales service detail page is open under this page, we can see our location field which is latitude and longitude which is the geolocation field is required.

How to make geolocation field required in Salesforce

In this way, we understand how to make the geolocation field required in Salesforce Lightning. Let’s Proceed further and learn how to make the geolocation relationship field required in Salesforce Classic.

How to make the geolocation field required in Salesforce Classic

Here we will learn how to make the geolocation field required in Salesforce Classic. Let’s take a real-life example, suppose there is a nonprofit organization that conducts community programs and events across various locations.

See also  How to Set Starting Number for Auto Number Field in Salesforce

This organization uses the salesforce to manage the event details, participant registration, and volunteer coordination. Here we want to make the geolocation field required to make sure that every event location is accurately recorded.

For this, they enable efficient planning and also improve the attendance tracking of each event.

Here are the following steps:

1. When we click on the salesforce account our lightning version is open, but here we want to work on the classic version. So to move to the classic version, click on the profile picture, under this profile picture, there is an option, to present a switch to Salesforce Classic. Click on this to switch to the Salesforce Classic version.

2. The drop-down list is open when we click on the username drop-down arrow. Under this drop-down list, we can see that the Setup option is present. Select the Setup option. We can see on the left side of the setup option that is Quick Find box is present.

3. Enter the objects in the Quick Find box, the objects come at the top and it is present at the Create option. Click the object option.

The custom object page will open, and we can see the lots of objects present that are already created and from these objects, we want to select the event object. On this page, we can see the details related to the event object.

How to make the geolocation field required in Salesforce Classic

4. Our event object page is open, Now scroll to the bottom of the page and here we can see the custom field section under this section, we can see lots of fields are present. But we want to create a new field. So we click on the new button.

Make the geolocation field required in Salesforce Classic

5. The new data type page is open. Under this page, you can see that lots of data types are present. Here we select the geolocation data type. after that Click on next button.

6. The event’s new custom field page is open. Now enter the details, first fill the field label as Event Location and then select the latitude and longitude display notation.

7. After that fill in the Decimal Places as 4 and then fill the field name by simply clicking on the field, and the field name is automatically filled, then fill the description if you want to fill otherwise leave the field as it is.

8. After that scroll to the bottom of the page, there is a general options section and under this section, there is a required checkbox is present.

9. Click on the required checkbox field, this field always requires a value in this field in order to save a record. Here we make the geolocation relationship field required, so that is why we click on the required checkbox and click on the save button.

Salesforce Classic make the geolocation field required

10. Now establish field-level security that can select the profiles to which we want to grant edit access to this field via field-level security. The field will be hidden from all the profiles if we do not add it to field-level security, click on the visible checkbox that can enable field-level security to all the profiles and then click on the next button.

How to make geolocation field required in Salesforce Classic

11. Now add this field to the page layout. Select the page layouts that should involve this field. This field will be added as the last field in the first 2-column section of these page layouts.

See also  How to Make Date Field Required in Salesforce

12. The field will not appear on any pages if we do not select a layout. To change the location of this field on the page, we will need to customize the page layout and then click on the save button.

Make geolocation field required in Salesforce Classic

13. Now we come back to our event page and scroll to the bottom there is a custom field and relationship section and under this section, we can see our event location field with geolocation data type is created successfully. When we click on this field our location field page is open.

14. Scroll to the bottom of the page and under the general options section we can see that the required checkbox is also checked. So this required field always requires a value in this field in order to save a record.

15. Go to the Home tab, and under the Home tab we can see lots of tabs are present on the nav bar here we click on the event tab, and our event object page is open. Under this page, we can see lots of event records are present. 

16. Here we want to create a new record, so we click on the new button. Our new event page is open. Now enter the information related to the event, first fill the event name and then fill the event detail and after that fill the event date and then fill the event start time.

17. After that fill the event date and time and then fill the event location in latitude after that fill the event location in longitude. If we leave the event location both latitude and longitude empty then the salesforce generates an error that is shown at the top of the page and under the event location field.

So don’t leave this field blank fill this employee field which is a required field and click on the save button.

Salesforce Classic make geolocation field required

18. After clicking on the save button it does not show any error it shows your record is created and our salesforce event record is created the details related to the event are shown and our event location field is also shown under the detail section.

How to make a geolocation field required in Salesforce Classic

So with this, we understand how to make the geolocation field required in Salesforce Classic.

Conclusion:

I hope you read the complete article and get the complete idea related to how to make the geolocation field required in Salesforce.  I have also explained all the steps of making the geolocation field required in Salesforce Lightning and Salesforce Classic.

You may like to read: