Salesforce Functions Tutorials

If you want to learn Salesforce Functions, start from here:

The well-known platform for customer relationship management (CRM) Salesforce is rapidly growing day by day and made its position in the business world. Due to this, Salesforce acknowledged the demand and released the powerful “Salesforce Functions”.

Our tutorials are designed to help you learn the various Salesforce Functions with proper syntax and real-world business-related examples. Moreover, our tutorial shows the practical implementation of using these Salesforce Functions in both Salesforce Lightning and Salesforce Classic components.

Our tutorial perfectly helps beginners to develop the Salesforce application with the use of the Salesforce Functions. This tutorial will take you through all the Salesforce Function Categories such as Date & Time, Logical, Math, Text, and Advanced.

You will also learn how these Salesforce functions help developers to compute and deploy various difficult tasks within a short time period, with less thinking power, and in short steps. And also allows the developers to automate the workflows, and do real-time data processing.

So whether you are a developer or an administrator, our Salesforce tutorials can help you get familiar with the powerful Salesforce Functions.

Here you will find a detailed tutorial on 50+ Salesforce Functions. Each Salesforce function is covered in detail with Examples and Videos.

Salesforce Functions – Math

Math functions in Salesforce are used for performing mathematical operations and manipulation of numerical data. It includes functions that are used for trigonometric calculations, absolute value, rounding, etc.

Salesforce FunctionDescription
Salesforce ABS FunctionThe Salesforce ABS function can be used when you want to get a positive numeric value of a number. It returns the absolute value of a number, a number without its sign.
Salesforce ACOS FunctionThe Salesforce ACOS function is best suited for situations when you focus on the magnitude of the value rather than the direction. It returns the arc cosine of the number in radians if the given number is between -1 and 1. Otherwise NULL.
Salesforce ASIN FunctionThe Salesforce ASIN function can be used when you want to find the angle whose sine is a given number. It returns the arc sine of the number in radians if the given number is between -1 and 1. Otherwise NULL.
Salesforce ATAN FunctionThe Salesforce ATAN function can be used when you are dealing with trigonometric calculations. It returns the arc tangent of the number in radians.
Salesforce ATAN2 FunctionThe Salesforce ATAN2 function is best suited for situations when you want to calculate finance, statistics, data analysis, etc. It returns the arc tangent of the quotient of y and x in radians.
Salesforce CEILING FunctionThe Salesforce CEILING function can be used when you want to round the decimal number. It rounds that number to the nearest integer that is greater than or equal to the original number, away from zero if negative.
Salesforce COS FunctionThe Salesforce COS function can be used in geolocation, distance, time, pricing, and forecasting calculations. It returns the cosine of the number, where the number is given in radians.
Salesforce DISTANCE FunctionThe Salesforce DISTANCE function is best suited to the situation where you need to work with geolocation data. It returns the distance between two locations using the provided unit.
Salesforce EXP FunctionThe Salesforce EXP function is used to return e raised to the power of a given number. If x is the argument, EXP(x) is equivalent to e^x, where “e” is the base of the natural logarithm.
Salesforce FLOOR FunctionThe salesforce FLOOR function can be used when you want to truncate the decimal part of a number, returning the nearest integer that is less than or equal to the given number. It rounds a number down, towards zero to the nearest integer.
Salesforce GEOLOCATION FunctionThe Salesforce GEOLOCATION function can be used to return a location based on the provided latitude and longitude. It is always used with other functions called DISTANCE, to perform location-based queries and calculations
Salesforce LN FunctionThe Salesforce LN function can be used to return the natural logarithm of a number. The natural logarithm of a number is the logarithm to the base e, where e is Euler’s number.
Salesforce LOG FunctionThe Salesforce LOG function can be used to return the base 10 logarithm of n. It is the exponent to which 10 must be raised to obtain n.
Salesforce MAX FunctionThe Salesforce MAX function can be used when you want to get the greatest value from the set of values passed as arguments.
Salesforce MCEILING FunctionThe Salesforce MCEILING function can be used when you want to round the decimal number. It rounds that number to the nearest integer that is greater than or equal to the original number, towards the zero if negative.
Salesforce MFLOOR FunctionThe salesforce MFLOOR function can be used when you want to truncate the decimal part of a number, returning the nearest integer. It rounds a number down, towards zero if negative.
Salesforce MIN FunctionThe Salesforce MIN function can be used when you want to get the least value from the set of values passed as arguments.
Salesforce MOD FunctionThe Salesforce MOD function can be best suited in scenarios like payment scheduling, time-based tasks, and inventory management. The MOD function, short for modulus that can be used to return the remainder after a number is divided by a divisor.
Salesforce PI FunctionThe Salesforce PI function can be used to return the value of PI. It returns the value approximately to 3.14159.
Salesforce ROUND FunctionThe Salesforce ROUND function can be best suited to situations when precision needs to be adjusted. It rounds to the number of decimal places to the right of the decimal point if the number is positive. If the number is negative it rounds to the left of the decimal point.
Salesforce SIN FunctionThe Salesforce SIN function can be used when you are dealing with trigonometric calculations. It returns the sine of the number, where the number is given in radians.
Salesforce SQRT FunctionSalesforce SQRT function is a mathematical function short for square root function. It returns the positive square root of a number. The square root of a negative number is not a real number, but a complex number, if you pass it results in an error.
Salesforce TAN FunctionThe Salesforce TAN function can be used to return the tangent of the given angle when the angle is given in the radians.
Salesforce TRUNC FunctionThe Salesforce TRUNC function can be used to cut off numerical values to a specified number of decimal places. It can used in use cases such as e-commerce, forecasting, tax calculations, etc.

Salesforce Functions – Text

Text functions in Salesforce are used to manipulate and analyze text strings. It includes functions that are used to extract substrings, convert text to lowercase or uppercase, calculate the length of the string, etc.

Salesforce FunctionDescription
Salesforce ASCII FunctionThe Salesforce ASCII function can be used to return the first character’s code point from the given string as a number. In a computer, each character has some special code point for example ‘A’ has a code point number of 65.
Salesforce BEGINS FunctionThe Salesforce BEGINS function can be used to compare the first character of the text. It checks if the text begins with specified characters, if it is it returns TRUE. Otherwise returns FALSE
Salesforce BR FunctionThe Salesforce BR function can be used to insert an HTML break tag in string formulas. It returns each field value on a new line.
Salesforce CASEFIELDID FunctionThe Salesforce CASEFIELDID function can be best suited in situations where you want to reduce issues related to case sensitivity. It is used to convert a 15-character case-sensitive Salesforce record ID into an 18-character case-insensitive ID.
Salesforce CHR FunctionThe Salesforce CHR function can used in the use cases where you want to get the character from the code point number. For example, 960 gives you the π. It returns a string with the first character’s code point as the given number.
Salesforce CONTAINS FunctionThe Salesforce CONTAINS function can be used to compare whether the text contains the substring or not. It checks if the text contains specified characters it returns TRUE. Otherwise, returns FALSE. The position of the text presented does not matter.
Salesforce FIND FunctionThe Salesforce FIND function can be used to find the position of the substring within the main text. If the substring is presented it returns the first position of the substring and if not found, it returns 0.
Salesforce GETSESSIONID FunctionThe Salesforce GETSESSIONID function can be used in the cases of hyperlinks to other applications that use salesforce.com credentials for authentication. It returns the current session ID.
Salesforce HYPERLINK FunctionThe Salesforce HYPERLINK function can be best suited in situations where you want to generate a clickable link. It creates a hyperlink.
Salesforce IMAGE FunctionThe Salesforce IMAGE function can create images based on certain conditions or field values.
Salesforce INCLUDES FunctionThe Salesforce INCLUDES function can be used if you want to determine if any of the selected values in a multi-select picklist field match a specific text literal. If any of the selected values in the multi-select picklist field match, it returns TRUE, otherwise, it returns FALSE.
Salesforce INITCAP FunctionThe Salesforce INITCAP function can be best suited when you want to make your input consistent, uniform, and in the proper format. It returns the text as lowercase with the first character of each word made uppercase.
Salesforce ISPICKVAL FunctionThe Salesforce ISPICKVAL function can be used if you want to determine if any of the selected values in the picklist field match a specific text literal. If any of the selected values in the picklist field match, it returns TRUE, otherwise, it returns FALSE.
Salesforce LEFT FunctionThe Salesforce LEFT function can be best suited in the scenario where you want to extract a specific portion of text data. It returns the specified number of characters from the start of a text string.
Salesforce LEN FunctionThe Salesforce LEN function can be best suited in the scenario where you want to assess or manipulate text lengths. It returns the number of characters in a text string.
Salesforce LOWER FunctionThe Salesforce LOWER function can be best suited in the scenario where you want to ensure that text is consistently represented in lowercase. It can be used to convert all letters in the value to lowercase.
Salesforce LPAD FunctionThe Salesforce LPAD function can be best suited in the cases where you want to make the length of the string specific. It can be used to pad the left side of the value with spaces or the optional pad string so that the length is padded length.
Salesforce MID FunctionThe Salesforce MID function can be used when you want to extract the character from the middle of a text string, from the given starting position to the specific length.
Salesforce PICKLISTCOUNT FunctionThe Salesforce PICKLISTCOUNT function can be best suited in the situation where you need to find out how many values are selected in the multi-selected picklist field. It returns the number of selected values in a multi-select picklist.
Salesforce REVERSE FunctionThe Salesforce REVERSE function can be used in scenarios like text manipulation, encryption, data transformation, etc. It returns the text string in reverse order.
Salesforce RIGHT FunctionThe Salesforce RIGHT function can be best suited in the scenario where you want to extract a specific portion of text data. It returns the specified number of characters from the end of a text string.
Salesforce RPAD FunctionThe Salesforce RPAD function can be best suited in the cases where you want to make the length of the string specific. It can be used to pad the right side of the value with spaces or the optional pad string so that the length is padded length.
Salesforce SUBSTITUTE FunctionThe Salesforce SUBSTITUTE function can be best used when you want to replace specific text in a text string. It substitutes new text for old text in a text string.
Salesforce TEXT FunctionThe Salesforce TEXT function can be suited to situations where you are sure that the result is treated as text. It converts a value to text using a standard display format
Salesforce TRIM FunctionThe Salesforce TRIM function can be best suited to situations where you want to make uniformity in the text. It removes all spaces from a text string except for single spaces between words.
Salesforce UPPER FunctionThe Salesforce UPPER function can be best suited in the scenario where you want to ensure that text is consistently represented in uppercase. It can be used to convert all letters in the value to uppercase.
Salesforce VALUE FunctionThe Salesforce VALUE function can be used where you need to perform mathematical operations on a field that is stored as text. It converts a text string that represents a number to a number.

Salesforce Functions – Date and Time

Date and Time functions in Salesforce are used to manage and manipulate date and time data. It includes functions that are used to calculate the difference between dates, extract components such as (day, month, year), formatting date and time value, etc.

Salesforce FunctionDescription
Salesforce ADDMONTHS FunctionThe Salesforce ADDMONTHS function can be used to add the number of months to the date, using the last date of the month if the date is the last day of the month or adding the number of months has fewer days.
Salesforce DATE FunctionThe Salesforce DATE function can be best suited in cases where you want to deal with dates only. It creates a date from a year, month, and day.
Salesforce DATETIMEVALUE FunctionThe Salesforce DATETIMEVALUE function can be best used in a situation where you want to convert a text string into a datetime. It returns a year, month, day, and GMT time value.
Salesforce DATEVALUE FunctionThe Salesforce DATEVALUE function can be used in situations where you need the date value from the expression. It creates a date from its datetime or text representation.
Salesforce DAY FunctionThe Salesforce DAY function can be best suited in situations where you need to extract the day part of the date or datetime field. It returns the day of the month, a number between 1 and 31.
Salesforce DAYOFYEAR FunctionThe Salesforce DAYOFYEAR function can be used where you want the day of the year from the given date. It returns the day of the calendar year from 1 to 366.
Salesforce FORMATDURATION FunctionThe Salesforce FORMATDURATION function can be best suited in situations where you want to format the duration of the date. It is used to format the number of seconds with optional days if set to True, otherwise, only the time part is included. Or the difference between times or dateTimes as HH:MI:SS.
Salesforce FROMUNIXTIME FunctionThe Salesforce FROMUNIXTIME function can be best suited in the situation where you want to convert a Unix timestamp into a human-readable date and time format. It returns the datetime that represents the given number as the seconds elapsed since 1 Jan 1970.
Salesforce HOUR FunctionThe Salesforce HOUR function can be best suited in situations where you need to extract the hour part of the time or datetime field. It returns the hour of the day.
Salesforce ISOWEEK FunctionThe Salesforce ISOWEEK function can be used to obtain the ISO 8601 week number for a given date. ISO 8601 is an international standard for representing dates and times. It returns the ISO 8601 week number for the given date from 1 to 53 so that the first week starts on Monday.
Salesforce ISOYEAR FunctionThe Salesforce ISOYEAR function can be used to return the ISO 8601 week-numbering 4-digit year for the given date so that the first day is a Monday.
Salesforce MILLISECOND FunctionThe Salesforce MILLISECOND function can be best suited when you want to extract the millisecond part from a given time expression. It returns an integer value representing the millisecond portion of the time expression.
Salesforce MINUTE FunctionThe Salesforce MINUTE function can be best suited in situations where you need to extract the minute part of the time or datetime field. It returns the minute of the day.
Salesforce MONTH FunctionThe Salesforce MONTH function can be best suited in situations where you need to extract the month part of the date or datetime field. It returns the month, a number between 1 (January) and 12 (December)
Salesforce NOW FunctionThe Salesforce NOW function can be best suited in the situation when you want to get the current date and time at the moment when the code is executed.
Salesforce SECOND FunctionThe Salesforce SECOND function can be best suited in situations where you need to extract the second part of the time or datetime field. It returns the second of the day.
Salesforce TIMENOW FunctionThe Salesforce TIMENOW function can be best suited in the situation when you want to get the current time at the moment when the code is executed.
Salesforce TIMEVALUE FunctionThe Salesforce TIMEVALUE function can be best suited in the situation where you want to extract the time portion from a date-time value or from a text representation of a time. It returns a time.
Salesforce TODAY FunctionThe Salesforce TODAY function can be used when you want to fetch the current date.
Salesforce UNIXTIMESTAMP FunctionThe Salesforce UNIXTIMESTAMP function can be best suitable in situations where you want to convert a date or date-time value into a Unix timestamp. The Unix timestamp is a way to represent a point in time as the number of seconds. It returns the number of seconds since 1 Jan 1970 for the given date, or the number of seconds in the day for a time.
Salesforce WEEKDAY FunctionThe Salesforce WEEKDAY function can be used in scenarios like scheduling, analyzing sales day, shift planning, campaigns, etc. It returns the day of the week for the given date, using 1 for Sunday, 2 for Monday, through 7 for Saturday.
Salesforce YEAR FunctionThe Salesforce YEAR function can be used when you want to extract the year from a date or datetime field. It returns the year of a date as a number between 1900 and 9999.

Salesforce Functions – Logical

Logical functions in Salesforce are used to evaluate conditions, make decisions, and return true or false based on the specified criteria. It includes functions that are used for IF statements, AND/OR conditions, handling null and blank values, etc.

Salesforce FunctionDescription
Salesforce AND FunctionThe Salesforce AND function can be best suited in situations where you want to make sure that multiple conditions are met simultaneously or in conjunction with expression. It checks whether all arguments are true and returns TRUE if all arguments are true.
Salesforce BLANKVALUE FunctionThe Salesforce BLANKVALUE function can be best suited in situations where you want to substitute space with another value. It checks whether the expression is blank and returns a substitute expression if it is blank. If the expression is not blank, returns the original expression value.
Salesforce CASE FunctionThe Salesforce CASE function can be used when you want to check an expression against a series of values.  If the expression compares equal to any value, the corresponding result is returned. If it is not equal to any of the values, the else-result is returned
Salesforce IF FunctionThe Salesforce IF function is best suited for situations where you want to perform conditional evaluations. It checks whether a condition is true and returns one value if the condition is true, and another value if the condition is false.
Salesforce ISBLANK FunctionThe Salesforce ISBLANK function is best suited for situations where you want to check whether a specified expression is blank. It returns TRUE if the expression is blank and FLASE if there is data in the field or expression.
Salesforce ISNULL FunctionThe Salesforce ISNULL function is best suited for situations where you want to check if the expression evaluates to a null value. It returns true if the expression is null. Otherwise, it returns false.
Salesforce ISNUMBER FunctionThe Salesforce ISNUMBER function can be used to check if the text value is a number if yes it returns TRUE. Otherwise, it returns FALSE.
Salesforce NOT FunctionThe Salesforce NOT function can be used to change FALSE to TRUE or TRUE to FALSE.
Salesforce NULLVALUE FunctionThe Salesforce NULLVALUE function can be used to check whether the expression is null and returns a substitute expression if it is null. If the expression is not null, returns the original expression value.
Salesforce OR FunctionThe Salesforce OR function can be best suited in situations where you want to make sure at least one of the conditions is met. It checks multiple conditions and returns TRUE if any of the given conditions is true. Returns FALSE only if all arguments are false.

Salesforce Function – Advanced

Advanced Salesforce function can be used in cases where the manipulation is not based on basic maths, text, logical, date, and time functions. It includes only the one function that is used for currency conversion in Salesforce.

Salesforce FunctionDescription
Salesforce CURRENCYRATE FunctionThe Salesforce CURRENCYRATE function can be best suited in the situation where you want to convert the currency to another currency rate. It returns the conversion rate to the corporate currency for the given CurrencyIsoCode, or 1.0 if the currency is invalid.

For detailed information on each Salesforce function and how they can be written and used in your business, click on the Salesforce Function Name.

Conclusion

I hope now you have an idea of Salesforce functions. Next, you can check about Salesforce Formulas and Error and Fixes.