How to Make Date And Time Field Required in Salesforce

The Salesforce Date and Time field permits the users to enter a date and time or pick a date from the popup calendar. When the users click a date in the pop-up, that date and the current time and entered into the date and time field.

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

Here we will learn how to make the date and time field required in Salesforce Lightning. Let us take an example to clearly understand the topic.

Suppose there is a company that manages the event and I am working as this company and I working as a manager and it’s my duty to handle all the events using the salesforce.

Here we are using the custom object called event that can track and manage the events and inside this event object, we can see there is event date and time field is present and we make this field required.

When the user tries to create a new event record we do not put any value inside the event date and time field so they would not be able to save it without providing a value in it. This makes sure that important information like the date and time of the event is always captured.

Here are the following steps

1. Click on the salesforce account and our salesforce lightning version is open, 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 custom object event.

How to make the date and time field required in Salesforce

3. The event 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 event date and time field and this has a date and time data type.

How to make the date and time field required in Salesforce Lightning

5. The event date and time page is open and under this page, we can see that the information is related to the event date and time and we want to edit this page.

6. So we click on the edit button. The event date and time fields come into edit mode and we can edit anything on this page.

7. 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  Salesforce Checkbox Group

8. So making the event date and time field requires, for that click on the required checkbox and click on the save button.

Make the date and time field required in Salesforce

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

10. 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 and time field required in Salesforce Lightning

11. 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. If the object is not shown on the nav bar click on the More drop-down arrow and under this More drop-down list, we can see lots of objects present. Click on the event object.

13. The event record page is opened. Under this page, we can see event record is saved. If you 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.

14. Here we fill in the event name and then fill the event detail and then fill the event date, and then fill in the customer contact, and then fill event start time after that fill the event email and then fill the event date and time which is the required field if we leave this filled empty it shows the error.

Salesforce make the date and time field required

15. So don’t leave this field blank fill in this event date and time field which is a required field after filling the event date and time and clicking on the save button it does not show any error it shows your record is created and our Salesforce event record has created the details related to the Salesforce event are shown and our event date and time field are also shown under the detail section.

Salesforce Lightning make the date and time field required

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

How to make the date and time field required in Salesforce Classic

Here we will learn how to make the date and time field required in Salesforce Classic. Let us take an example, Imagine there is a company that uses Salesforce for managing tasks I am the manager of the company, and it’s my duty to check all the things like tasks, projects are done on time or the employee of the company complete their work before due date or not.

See also  Salesforce Case Sensitivity For Text Field Type

For this, I make the due date of the task object required, when the user tries to create a new task in Salesforce, they would not be able to save it without entering a value for the due date field.

This also makes sure that the users are produced to specify a due date for each task which can help in better task management.

Now follow the following steps

1. When we click on the salesforce account we can see our lightning version is open but we want to our 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 task object. Click on the task object. On this page, we can see the details related to the task object.

How to make the date and time 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 task date and time field and made this task date and time field required.

Make the date and time field required in Salesforce Classic

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

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 and time field required

9. After clicking on the confirm button, we can see that our required field is checked. That always requires a value in this field in order to save a record and that required field is present under the general options section after checking the checkbox is checked click on the save button.

Make date and time field is required in Salesforce Classic

10. After clicking on the save button we can see our task date and time custom field 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 and time 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 task tab, and our task object page is open. Under this page, we can see task record is saved. 

See also  How to add Picklist Values in Salesforce

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

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

Salesforce Classic make date and time field required

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

How to make date and time field is required in Salesforce Classic

So with this, we understand how to make the date and time 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 and time field required in Salesforce.  I have also explained all the steps of making the date and time field required in Salesforce Lightning and Salesforce Classic.

You may like to read