How to Make Date Field Required in Salesforce

In Salesforce date field is a type of field that can store a particular date without a time component. It is used to store the dates in various salesforce objects like custom objects and standard objects.

In this Salesforce tutorial, we will learn how to make the date field required 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 date field required in Salesforce Lightning

Here we will learn how to make the date field required in Salesforce Lightning. Let’s take a real-life example, imagine there is a company based in the United States that sells the products and uses the salesforce.

Now company members decided to give lots of opportunities to the users and they also decided to make the due date field required, from this, the company also gets the information related to the opportunity due date.

Here we are choosing the opportunity object and under the opportunity object, we can see the due date field we make this due date field required and thid make sure that the user must specify a due date when creating or updating an opportunity record.

Here are the following steps

1. Click on the salesforce lightning version, and then select the setup option this setup option is present under the gear icon. Our Setup page is open.

2. Under the setup page there is an object manager tab is present. Click on this object manager tab. Under the object manager page, lots of objects are present and we are selecting the standard object opportunity.

How to make the date field required in Salesforce

3. The opportunity detail page is open, on the left side of the page we can see there is a field and relationships option. The fields and relationship page is open, inside this page we can see lots of fields are already created.

4. Here we are selecting the already created field which is the due date field and this has a date data type.

How to make the date field required in Salesforce Lightning

5. The due date page is open and under this page, we can see that the information is related to the due date and we want to edit this page. So we click on the edit button. The due date fields come into edit mode and we can edit anything on this page.

6. 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. 

7. So making the due date field requires, that click on the required checkbox and click on the save button.

See also  How to Set Default Value For Text Field in Salesforce
Make the date field required in Salesforce

8. After clicking on the save button we can see that our custom field event date and time page is open under this page we can see that the field label, field name, and API name are shown as filled.

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

Make the date field required in Salesforce Lightning

10. 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.

11. Here we are selecting the opportunity object which is the standard object. The opportunity record page is opened. Under this page, we can see opportunity record is saved. 

12. If you want to create a new record, click on the new button. The new opportunity dialogue box is open. Here we can fill in the information related to the opportunity.

13. Here we fill in the opportunity name and then fill the type and then fill the lead source, and then fill in the time duration, and then estimated closed date fill event closed date after that fill the stage and then fill the order number and after that fill the due date which is the required field if we leave this filled empty it shows the error.

Salesforce make the date field required

14. So don’t leave this field blank fill in this due date and time field which is a required field after filling in the due date and time and clicking on the save button it does not show any error it shows your record is created.

15. A Salesforce opportunity record has been created the details related to the Salesforce opportunity record are shown and our due date field is also shown under the detail section.

Salesforce Lightning make the date field required

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

How to make the date field required in Salesforce Classic

Here we will learn how to make the date field required in Salesforce classic. Let us take an example, there is a company that manages the events for the users and here we want to make the event field required for a custom object called event.

This makes sure that the user must specify the date when they create or update the record of the event. They will be led to provide a value for the event date field. If they try to save the record without entering an event date.

See also  How to Create Date Field Type in Salesforce

The Salesforce will show an error message that indicates the field is required. You must enter the field value.

Follow the following steps

1. Click on the salesforce account we can see our lightning version is open but we work on the classic version so for this click on the profile picture, and under this profile picture, there is an option to present a switch to Salesforce Classic.

2. Click on the switch to the Salesforce Classic version. Click on the drop-down arrow of the username. The drop-down list is open. Under this drop-down list, we can see that the Setup option is present. Select the Setup option.

3. We can see on the left side of the setup option that is Quick Find box is present. 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.

4. Our custom object page will open here we can see the lots of objects present that are created by us and here we want to select the event object. Click on the event object. On this page, we can see the details related to the event object.

How to make the date field required in Salesforce Classic

5. Now scroll to the bottom of the page and here we can see the custom field section under this section, we can see some fields present that are already created by us. From these fields, I selected the event date field and made this event date field required.

6. The event date custom field page is open and here we can see the details related to the event date custom field, scroll to the bottom of the page we can see there is a general options section present.

Make the date field required in Salesforce Classic

7. Under this section we can see the required checkbox is present which makes our field required and the default value field present. Here we click on the required checkbox after clicking on the checkbox.

8. The warning message pops up that is a warning: Potential Integration Impact that makes this field required may break the existing API or Apex requests that do not supply a value for this field after reading the message carefully click on the confirm button.

Salesforce Classic make the date field required

9. After clicking on the confirm button we can see our event date custom field page is again open here when we scroll to the bottom we can see under the general options we can see our required field is checked. This required field always requires a value inside this field in order to save the record and then click on the save button.

How to make date field required in Salesforce Classic

10. After clicking on the save button we can see our event date custom field definition detail page is open here we can see the details related to this field and when we scroll to the bottom we can see under the general options we can see our required field is checked.

Make date field required in Salesforce Classic

11. 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 event record is saved. 

See also  Picklist Value not Showing Salesforce

12. We want to create a new record, click on the new button. The new event dialogue box is open. Here we can fill in the information related to the event. Here we fill in the event name and then fill the event details and then fill the event start date and after that fill the event date and time and fill the event date.

13. If we leave the event date field empty then the salesforce generates an error that is shown at the top of the page and under the event date field. So don’t leave this field blank fill this event event field which is a required field and click on the save button.

Salesforce Classic make date field required

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

How to make a date field required in Salesforce Classic

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

Conclusion:

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

You may like to read