Salesforce Weekday Formula

In this Salesforce Tutorial, we will learn the formula of Weekday. Moreover, we will go through the steps using the weekday formula in Salesforce Lightning and Salesforce Classic.

While working in an organization that uses Salesforce as a CRM tool, I got a task where I need to display the day of the week for a date field. So, to fulfill this requirement, I use the Weekday functionality of Salesforce.

If you want to learn How to use Weekday Advance Formula in Salesforce Lightning and Salesforce Classic, you have come to the right place.

The following are the topics that we will cover in this salesforce tutorial:

  • How to use Weekday Formula in Salesforce Lightning
  • How to use Weekday Formula in Salesforce Classic

How to use Weekday Formula in Salesforce Lightning

Here, are the steps to use the Weekday Advance Formula in Salesforce Lightning.

Step 1: Navigate to Salesforce Setup, by clicking on the Setup icon on the upper right side of the page.

Step 2: On the left side of the menu, click on Object Manager.

How to use Weekday Formula in Salesforce Lightning
Weekday Formula in Salesforce Lightning

Step 3: Search for the object to which we want to get the Weekday. Here, I select the Campaign object from the list of objects.

How to use Weekday Formula in Salesforce Lightning Example
Weekday Formula in Salesforce Lightning Example

Step 4: Click on Fields & Relationships.

Step 5: Then, click on New.

Use Weekday Formula in Salesforce Lightning
Use Weekday Formula in Salesforce Lightning

Step 6: Choose the Formula as the field type.

Step 7: To continue, click Next.

Salesforce Lightning Example Weekday Formula
Salesforce Lightning Example Weekday Formula

Step 8: Enter a Field Label for the formula, and the Field Name will be automatically populated. Here, I enter Field Label as the Start Week Day.

Step 9: Choose Number as the Formula Return Type. Then, click Next.

Use Weekday Formula in Salesforce Lightning Example
Use Weekday Formula in Salesforce Lightning Example

Step 10: Enter the Weekday formula in the Advance Formula editor. Here, is the formula:

WEEKDAY(StartDate)
  • In this formula, we use the WEEKDAY() formula to get the day of the week for the given date field called “StartDate”.

Step 11: Click Check Syntax to make sure the formula is correct.

Step 12: We can add the Description and Help Text as options, and we can also state how you want to handle the blank field.

Step 13: After that, click Next.

Weekday Formula in Salesforce Lightning
Weekday Formula in Salesforce Lightning

Step 14: Select the appropriate field Level Security and to make it visible to everyone, here we select the Visible checkbox.

Step 15: Select Next.

Weekday Formula in Salesforce Lightning Example
Weekday Formula in Salesforce Lightning Example

Step 16: Choose the Page Layout Name, for whom we want to add the formula field.

Step 17: To save the formula field, click Save.

Salesforce Lightning Weekday Formula
Salesforce Lightning Weekday Formula

We can use the formula field once we’ve created it. Let’s look at an example:

  • Create a Campaign with the StartDay value field by opening the Campaigns object and saving it.
  • After that, click on the Details section, and here the Start Week Day field will appear the week of the day.
Salesforce Lightning Weekday Formula Example
Salesforce Lightning Weekday Formula Example

As a result, we now know how to use Salesforce Lightning’s advanced formula to get the weekday from the date. Next, we’ll look at how to use Salesforce Classic’s advance formula to get the weekday from the date.

Read Convert DateTime to Date Salesforce

How to use Weekday Formula in Salesforce Classic

Here, are the steps to use the Weekday Advance Formula in Salesforce Classic.

Step 1: From the Salesforce Lightning to open your Salesforce Classic edition. Click on Avtar and click Switch to Salesforce Classic.

How to use Weekday Formula in Salesforce Classic
Use Weekday Formula in Salesforce Classic

Step 2: Click on the Setup option.

How to use Weekday Formula in Salesforce Classic Example
Use Weekday Formula in Salesforce Classic Example

Step 3: Scroll down to the Build section. Then under Customize, select the object for whom we want to get the weekday of the date. Here, I choose the Contacts from the object list.

Step 4: Click on the dropdown menu and select Fields.

Use Weekday Formula in Salesforce Classic
Use Weekday Formula in Salesforce Classic

Step 5: As you scroll down the page, click on the New button under Custom Fields & Relationships.

Use Weekday Formula in Salesforce Classic Example
Use Weekday Formula in Salesforce Classic Example

Step 6: Select the Formula as the field type.

Step 7: Click Next to proceed.

Weekday Formula in Salesforce Classic
Weekday Formula in Salesforce Classic

Step 8: Enter a Field Label for the formula, and the Field Name will be automatically populated. Here, I enter Field Label as the Birth Date Week.

Step 9: Choose Number as the Formula Return Type and then click Next.

Weekday Formula in Salesforce Classic Example
Weekday Formula in Salesforce Classic Example

Step 10: Enter the formula to get the Weekday of the Date in the advance formula editor. The formula is as follows:

WEEKDAY(Birthdate)
  • In this formula, we use the WEEKDAY() formula to get the day of the week for the given date field called “Birthdate”.

Step 11: To verify that the formula is valid, click Check Syntax.

Step 12: We can specify how you want to handle the empty field and include the Description and Help Text optionally.

Step 13: Then, click Next.

Salesforce Classic Weekday Formula
Salesforce Classic Weekday Formula

Step 14: Choose the appropriate Field’s Level Security, and then check the box Visible to make it visible to all.

Step 15: Click Next.

Salesforce Classic Weekday Formula Example
Salesforce Classic Weekday Formula Example

Step 16: Choose the Page Layout Name for which the formula field is to be added.

Step 17: Click Save to save the formula field.

Salesforce Classic Weekday Advance Formula
Salesforce Classic Weekday Advance Formula

Once we’ve defined the formula field, we may use it. Let’s explore an example:

  • Create a new contact with the Birth Date field value by opening the contacts object and saving it.
  • After that, click on the Details section, and here the Birth Date Week field will appear with the weekday of the date.
Salesforce Classic Weekday Advance Formula Example
Salesforce Classic Weekday Advance Formula Example

In a conclusion, we now understand how to get the weekday from the date using Salesforce Classic’s advanced formula.

Also, Read:

Conclusion

In conclusion, we have learned the advance salesforce formula to get the Weekday of the date field.

Moreover, we have learned that both Salesforce Classic and Salesforce Lightning provide a simple procedure to get the Weekday of the date field.

In addition to this, the following are the topics that we have discussed:

  • How to use Weekday Formula in Salesforce Lightning
  • How to use Weekday Formula in Salesforce Classic