Security and Access: 20% Flashcards
What are the Elements that you might find in a Formula?
- Literal value: A text string or number you enter that is not calculated or changed. For example, if you have a value that’s always multiplied by 2% of an amount, your formula would contain the literal value of 2% of that amount: ROUND((Amount*0.02), 2)
- Field Reference: Reference the value of another custom or standard field using a merge field.
- Function: A system-defined formula that can require input from you and returns a value or values. For example, TODAY() does not require input but returns the current date. The TEXT(value) function requires your percent, number, or currency input and returns text.
- Operator: A symbol that specifies the type of calculation to perform or the order in which to do it. For example, the + symbol specifies two values should be added. The open and close parentheses specify which expressions you want evaluated first.
- Comments: useful for explaining specific parts of a formula to anyone viewing the formula definition.
What is a Literal Value?
A text string or number you enter that is not calculated or changed. For example, if you have a value that’s always multiplied by 2% of an amount, your formula would contain the literal value of 2% of that amount:
ROUND((Amount*0.02), 2)
This example contains every possible part of a formula:
A function called ROUND used to return a number rounded to a specified number of decimal places.
A field reference called Amount.
An operator, *, that tells the formula builder to multiply the contents of the Amount field by the literal value, 0.02.
A literal number, 0.02. Use the decimal value for all percents. To include actual text in your formula, enclose it in quotes.
The last number 2 in this formula is the input required for the ROUND function that determines the number of decimal places to return.
What are the formula operators and functions, A-H?
+ (Add): Calculates the sum of two values.
- (Subtract): Calculates the difference of two values.
* (Multiply): Multiplies its values.
/ (Divide): Divides its values
^ (Exponentiation): Raises a number to a power of a specified number.
() (Open Parenthesis and Close Parenthesis): specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All other expressions are evaluated using standard operator precedence.
= and == (Equal): Evaluates if two values are equivalent. The = and == operators are interchangeable.
What is a Function?
A system-defined formula that can require input from you and returns a value or values.
For example, TODAY() does not require input but returns the current date. The TEXT(value) function requires your percent, number, or currency input and returns text.
List an example of a Text Operator you can use in Salesforce Formulas
& (Concatenate)
Connects two or more strings.
For Date and Time Functions, what does ADDMONTHS do?
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.
DATETIMEVALUE Returns a year, month, day, and ___ time value.
Returns a year, month, day, and GMT time value.
In Date and Time Functions, what does DAY do?
Returns a day of the month in the form of a number between 1 and 31.
What function should you use instead of the NOW function if you only want to track time, without a date?
TIMENOW
Returns a time value in GMT representing the current moment.
Example:
IF(ISPICKVAL( Rating , “Hot”), TIMENOW(), TIMEVALUE(CreatedDate))
This formula checks to see if a lead is rated “Hot” and if so, returns the current time. Otherwise it returns the time since someone created the lead.
Tips:
Do not remove the parentheses.
Keep the parentheses empty. They do not need to contain a value.
Use TODAY if you prefer to use a date field.
The displayed value is based on the organization’s Locale settings.
What is the different between BLANKVALUE and ISBLANK?
BLANKVALUE: Determines if an expression has a value and returns a substitute expression if it doesn’t . If the expression has a value, returns the value of the expression.
ISBLANK: Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this function returns FALSE.
What does ISCLONE do?
Checks if the record is a clone of another record and returns TRUE if one item is a clone. Otherwise, returns FALSE.
Which should you use in new formulas?
ISBLANK or ISNULL? How are they different?
IMPORTANT Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL, but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas.
What are all the MATH FUNCTIONS that can be used in a formula?
FUNCTION
ABS: Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign.
CEILING: Rounds a number up to the nearest integer, away from zero if negative.
DISTANCE: Calculates the distance between two locations in miles or kilometers.
EXP: Returns a value for e raised to the power of a number you specify.
FLOOR: Returns a number rounded down to the nearest integer, towards zero if negative.
GEOLOCATION: Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE function.
LN: Returns the natural logarithm of a specified number. Natural logarithms are based on the constant e value of 2.71828182845904.
LOG: Returns the base 10 logarithm of a number.
MAX: Returns the highest number from a list of numbers.
MCEILING: Rounds a number up to the nearest integer, towards zero if negative.
MFLOOR: Rounds a number down to the nearest integer, away from zero if negative.
MIN: Returns the lowest number from a list of numbers.
MOD: Returns a remainder after a number is divided by a specified divisor.
ROUND: Returns the nearest number to a number you specify, constraining the new number by a specified number of digits.
SQRT: Returns the positive square root of a given number.
What does BEGINS do?
BEGINS Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it doesn’t.
What does CASESAFEID do?
Converts a 15-character ID to a case-insensitive 18-character ID.
How would you use a default value formula to insert a different discount rate on an opportunity based on the department of the person creating the opportunity - (what might the formula look like)?
Use the following default value formula to insert a different discount rate on an opportunity based on the department of the person creating the opportunity:
CASE(User.Department, “IT”, 0.25, “Field”, 0.15, 0)
What returns the conversion rate to the corporate currency for the given currency ISO code?
CURRENCY RATE
If the currency is invalid, returns 1.0.
What is the description and use of the DISTANCE formula?
Description: Calculates the distance between two locations in miles or kilometers.
Use: DISTANCE(mylocation1, mylocation2, ‘unit’) and replace mylocation1 and mylocation2 with two location fields, or a location field and a value returned by the GEOLOCATION function.
Replace unit with mi (miles) or km (kilometers).
What is the only formula function that can use GEOLOCATION parameters?
DISTANCE is the only formula function that can use GEOLOCATION parameters.
What formula returns the position of a string within a string of text represented as a number? How can it be used?
FIND returns the position of a string within a string of text represented as a number.
FIND(search_text, text[, start_num]) and replace search_text with the string you want to find, replace text with the field or expression you want to search, and replace start_num with the number of the character from which to start searching from left to right.
Example: SUBSTITUTE(Email, LEFT(Email, FIND(“@”, Email)), “www.”) finds the location of the @ sign in a person’s email address to determine the length of text to replace with a “www.” as a means of deriving their website address.
The ________ function returns a location data type that can be used only by, and must be used with, the DISTANCE function.
The ________ function doesn’t work on its own.
The GEOLOCATION function returns a location data type that can be used only by, and must be used with, the DISTANCE function.
The GEOLOCATION function doesn’t work on its own.
What does the formula ABS do?
ABS
Description: Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign.
Use: ABS(number) and replace number with a merge field, expression, or other numeric value that has the sign you want removed.
Example: ABS(ExpectedRevenue) calculates the positive value of the Expected Revenue amount regardless of whether it’s positive or negative.
What returns an array of strings in the form of record IDs for the selected records in a list, such as a list view or related list?
GETRECORDIDS returns an array of strings in the form of record IDs for the selected records in a list, such as a list view or related list.
Use:{!GETRECORDIDS(object_type)} and replace object_type with a reference to the custom or standard object for the records you want to retrieve.
What two things can HTMLENCODE be used for in Salesforce?
HTMLENCODE
Tips: This function is only available in custom buttons and links, and in Visualforce.
Description: Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML, such as the greater-than sign (>), with HTML entity equivalents, such as >.
Use :{!HTMLENCODE(text)} and replace text with the merge field or text string that contains the reserved characters.
Example:If the merge field foo__c contains Enter the user’s name , {!HTMLENCODE(foo__c)} results in: Enter the user’s name
