New Formula Functions in Salesforce Spring ’18 Release

In the Spring ‘18 release, Salesforce has come up with some long-awaited formulas useful for Admins. Functions like Addmonths, Currencyrate, Mceiling, Mfloor, and Weekday are now part of Salesforce formula editor. These will definitely make life easier for Admins.

Salesforce has rolled out Spring’18 release to all the orgs. You can check out the official release notes here

Let us go over these new formulas along with some examples.

ADDMONTHS

Purpose: Returns the date that is the indicated number of months before or after a specified date. If the resulting month has fewer days than the start month, then the function returns the last day of the resulting month. Otherwise, the result has the same day component as the specified date.

Syntax: ADDMONTHS(date,num)

  • Date: Specify the date field to be used as the base
  • Num: Specify the number of months added to the base date field

Example: Calculate the contract renewal date which is 12 months after the Opportunity close date. So the formula for contract renewal date would be – Contract Renewal Date = ADDMONTHS(CloseDate,12)

CURRENCYRATE

Purpose: This formula returns the conversion rate used for a record’s currency code.

Syntax: CURRENCYRATE(IsoCode)

  • IsoCode – the currency code in the ISO format; you are required to enter the quotes (e.g. “EUR”) as the expected value is Text. The return format of the result is Number

Example: If you have corporate (Org’s default) currency as USD.  But the record’s currency is GBP – you can now retrieve the conversion rate between those currencies and display it as a formula field or use it in reports. The returned value will be a number showing the currency conversion rate, eg 0.717412 (you will be able to control how many decimals are shown).

Note:Your arg. Should be multi currency enabled to use this function.

MCEILING

Purpose : Rounds a number up to the nearest positive whole number; towards zero if negative. Previously, we did have access to ROUND function – Round(decimalNumber, 2)

Syntax : MCEILING(number)

MFLOOR

Purpose : Rounds a number down to the nearest integer; away from zero if negative.

Syntax : MFLOOR(number)

WEEKDAY

Purpose : Returns the day of the week for the given date, using 1 for Sunday, 2 for Monday, through 7 for Saturday. This formula helps you identify weekend and weekdays.

Syntax : WEEKDAY(CloseDate)

These are welcome additions to add to the power of configuration in Salesforce.

 

Team Varasi

Shailesh Bhide
Shailesh Bhide
Shailesh is a Principal at Varasi. He shares thoughts and insights on technical know-how and patterns that helps us build elegant Salesforce solutions for our customers. He is passionate about leveraging the Salesforce platform to its full potential.