Amazon

Tuesday, August 18, 2015

Understanding Account and Contact Relationships

Three Key Account and Contact Relationships

You’re preparing to meet with Alan and Leung from ABC Genius Tech Consulting. You’ve done your research in reviewing their company’s past history with Cloud Kicks. Now you need to build up some business relationships.
Strong relationships can help you build and maintain success as you work with ABC Genius. There are three particular types of relationships to consider. Which of your employees work with the account? How is it related to other accounts? And what roles will Alan and Leung serve in your deal?

Contact Roles

You know you’re meeting with Alan and Leung, but you don’t know a whole lot about them. If they’ve been assigned Contact Roles, you can tell at a glance which role they play in the organization. The Contact Role is separate from each contact’s job title, which might not tell you much about what part a contact plays in consumer decisions.
Contact Roles lets you indicate a contact’s role in deciding to buy your products or services, regardless of their job title. When you know which role each contact plays, you’ll have a better idea how to work with them.
Alan and Leung are both managers in different departments but Leung’s role is to make the final buying decision, while Alan’s role is to give an opinion. The best roles for them are Decision Maker and Influencer. Both these roles are set up by default in Salesforce. You can also use the Contact Roles related list to note that Leung is the primary contact person for this account.
The Contact Roles list doesn’t appear on the Contact page until it’s added by an administrator. Let’s add the Contact Roles related list now, and then add Leung and Alan’s roles.

Add Contact Roles for Accounts

  1. From Setup, click Customize | Accounts | Contact Role.
  2. Click New.
  3. Enter the name and one or more new roles.
  4. Click Save.
You can edit the names of existing contact roles or delete existing contact roles in the same location. Any edits you make will be passed along to contacts that are currently assigned to that role. For example, if you decide that “Evaluator” isn’t specific enough, you can rename the role to “Product Evaluator”. All contacts were assigned to the “Evaluator” contact role on accounts will now have the “Product Evaluator” role.

Make the Contact Role Related List Visible on Accounts

  1. From Setup, click Customize | Accounts | Page Layouts.
  2. Next to the page layout to which you want to add Contact roles, click Edit.
  3. Select Related Lists.
  4. Drag Contact Roles below the Contacts related list.
  5. Click Save.

    Add a Role for a Contact

    1. In the Contact Roles related list of an account, click New .
    2. Click the lookup icon to select a contact or person account. Optionally, click New to create a contact.
    3. Choose a role. If you don’t select a role or the role is set to None, any changes you make to the record aren’t saved.
    4. Optionally, select Primary to set the contact as primary for the account.
    5. Click Save.

    Account Hierarchies

    Alan and Leung work at the ABC Genius Tech Consulting corporate office in Boulder, but you noticed that when you searched for ABC Genius that you have several other accounts with similar names: ABC Genius Tech Consulting East, ABC Genius Tech Consulting West, and ABC Genius Tech Consulting Canada. In the ABC Genius Tech Consulting West account record, ABC Genius Tech Consulting is listed as the Parent Account.
    How are all these companies related? Are you going to have to dig through every single record to find out? That could take a lot of time!
    If you’ve recorded the Parent Account for each account that has one, Salesforce can generate a family tree for your account. The hierarchy shows this relationship for the ABC Genius Tech accounts.To view an account’s hierarchy, click on the Accounts tab and select an account. Click the View Hierarchy link next to the Account Name field.

    Best Practices for Establishing Account Hierarchies

    You have two basic choices when you’re deciding how to establish accounts for businesses with multiple locations.
    Global Enterprise Account
    You could establish one global account and link all contacts, opportunities, cases, and so on to that single overarching account. Using one global account makes it easy to find that account’s records and to report on that account at the enterprise level. But it’s harder to manage a large mass of information, and not being able to easily view the big picture might make it hard to see what each location needs from you for your relationship to be successful.
    Location-Specific Accounts
    Establish accounts for each location and create contacts, opportunities, cases and so on separately for each location. With this option, you maintain more accounts and need to set up a few more complex reports to get the big picture. But using multiple accounts means you can take advantage of account ownership, hierarchies, specific sharing settings, and more granular reporting. You can also more easily track and report on opportunities, cases, and other interactions for each account.
    We recommend establishing accounts for each separate location, rather than squeezing all locations into a single global account. This arrangement lets you concentrate on customer success in each location while still giving you the ability to put the big picture together.

    Account Teams

    Unless your company is teeny tiny, it’s likely that more than one person works with each account. For example, the team of employees for an account might include a sales rep, sales manager, support agent, support manager, and marketing personnel.
    A Salesforce Account Team can contain up to five people, each of whom can be assigned different roles and different levels of access to the account and its opportunities and cases. Like Contact Roles, Account Teams isn’t set up automatically. An administrator must turn it on and set up the roles that each team member can be assigned.

    Enable Account Teams

    1. From Setup, click Customize | Accounts | Account Teams.
    2. Click Enable Account Teams.
    3. Select Account Teams Enabled and click Save.
    4. Select the account page layouts on which to include the new Account Team related list and click Save. Optionally, you can also select Add to users’ customized related lists to add the Account Team related list for users who have changed their personal settings for Account record pages.
    5. Optionally, click Team Roles to review or edit team roles.

    Assign an Account Team

    1. On the Accounts tab, select an account to view and scroll down.
    2. On the Account Team related list, click Add.
    3. Click the search icon to select a Salesforce user to assign to the team. If you haven’t set up any other users, the only person that you can assign to the team is yourself.
    4. For each team member, select a level of access to the account and to opportunities and cases related to the account.
    5. For each team member, select the team member’s role.
    6. Click Save.
    After you add an account team, the button Add Default Team displays right next to Add button. Default Teams is a shortcut that saves you from having to enter the same members into the same form over and over again. If the same people usually work together, create a default account team and assign them to it. You can even set Salesforce to add your default account team every time and eliminate the need to click buttons at all. Visit Setting Up Default Account Teams to find out how.

Accounts & Contacts In Salesforce

Accounts and Contacts

You need insight into your business and your data and that starts with the people you're doing business with. In Salesforce, you store information about your customers using accounts and contacts. Accounts are companies that you're doing business with, and contacts are the people who work for them.
If you’re doing business with a single person, like a solo contractor or an individual consumer you use a special account type called a Person Account.
For the purposes of this module, we’ll assume you’re selling to businesses only, and your accounts are all business accounts. But almost everything you learn here can be applied to both types of accounts.
Accounts and contacts are related to many other standards objects, which makes them some of the most important objects in Salesforce. Understanding how to use accounts and contacts is key to getting the most out of Salesforce CRM.

Business Accounts

You’re on your way to a meeting with a customer, ABC Genius Tech Consulting. They're a head corporate office of a national company, and you think they’ll love the latest Cloud Kicks sneakers design. You need to brush up on their needs and buying history, and you want to wow them by knowing who’s who at ABC. You can find the information you need in Salesforce.
In Salesforce, the companies that you’ve sold to are Business Accounts. To prep for your meeting, you start by going to the Accounts tab and finding the listing for ABC Genius Tech Consulting. Click the account name to view details about the account.
When you open the account record, you see the information collected on the company as a list of records related to it, such people who work there, deals in the works, service requests, uploaded documents, and more.
To prepare for your meeting, you can review the details about the ABC Genius Tech Consulting company and click on anything listed in its related lists. For example, you see that ABC Genius Tech Consulting filed a service case about two months ago. Click the case to learn more about the problem they had with their order.
If you’re on the road without your computer, you can view most of the same account information using the Salesforce1 mobile app. In Salesforce1, tap Account, search for ABC, and tap ABC Genius Tech Consulting.
Let’s create an account for ABC Genius Tech Consulting in Salesforce.
  1. Click the Accounts tab.
  2. Click New.
  3. Enter the account’s name.
  4. Enter all the information you’ve got about ABC Genius Tech Consulting.
  5. Click Save.

Business Contacts

One of the most important things you need to know about a company is who works there and how to reach them. In Salesforce, the people who work at your accounts are called Contacts. Each account has at least one contact person, and each contact is related to an account.
Your contacts at ABC Genius Tech Consulting are Alan Johnson and Leung Chan. In Salesforce, you have a contact record for Alan, listing his employer (Account), email address, and phone number. You’d have a second contact record for Leung, listing her employer (Account), email address, and phone number.
Because Alan and Leung already have records in Salesforce, you’d find them by clicking the Contacts tab and locating them in the Recent Contacts list, or selecting a view and clicking Go. And because both Alan and Leung are contacts for the account ABC Genius Tech Consulting, you’d find them both listed below that account’s record details. Click Leung or Alan’s name to view the full contact record.
Like an account record, a contact record can have its own related lists of information, such as cases that each contact has filed, meetings you’ve had, or logs of calls to that contact.
Let’s add Alan Johnson and Leung Chan as contacts.
  1. Click the Accounts tab.
  2. Click the ABC Genius account.
  3. Scroll down to find the Contacts related list, and click New to create a contact.
  4. Add all the information you have about the contact. You’re required to add at least the contact’s last name and to select the name of the account where the contact works.
  5. Click Save.

Selling to Individual Customers: Person Accounts

Notice that when we discussed Accounts above, we specifically discussed Business Accounts, which are optimized for selling to companies or other organizations.
If you have customers who are individuals, not companies, your Salesforce organization can be set up to use Person Accounts.
Person Accounts let you store information that applies to human beings rather than corporations, such as a first name and a last name.
Person and business account have a few important differences.
  • Person accounts are forever. After they're turned on, you can't turn them off.
  • If your organization uses both business accounts and person accounts, you’ll have to select which type of account you’re creating whenever you add an account.
  • Person accounts can’t have contacts.
  • Person accounts don’t have an account hierarchy.
  • You can associate person accounts with social network profiles in the Social Accounts, Contacts, and Leads feature.
  • You can’t get account news for person accounts.
  • You can’t use contact roles with person accounts.

Keeping Up with Your Accounts

Before you head to your meeting, you might take a few minutes to find out the latest news about your account or the people who work there. You could do this by opening up a web browser and running multiple searches to find out what’s going on with ABC Genius Tech Consulting, or the technology industry, or reviewing social network profiles for Alan and Leung, if you can find them. Your search might even show you what they’ve been doing on Twitter or Facebook lately.
Or, you can check all of that from within Salesforce.

Social Accounts and Contacts

The Social Accounts, Contacts, and Leads feature adds social network information from Twitter, Facebook, YouTube, and Klout to your records. To use it, you must have an account on each social network that you’re using, and you have to link the account or contact record to a user profile on each social network.
After you’ve set that up, the social network information for the contact or account is available on the account record or contact record on the full Salesforce site. On Salesforce1, you can view social network information for Twitter users only.
You can’t see anything about an account or contact that wouldn’t normally be available to you when you’re logged in to the social network. But you can see that information at a glance and easily switch between networks. If you connect a Facebook or Twitter profile for an account, contact, or lead, you can use the social network profile image as the profile image for that account, contact, or lead in Salesforce.
Before you can use the Social Accounts, Contacts, and Leads feature, your admin must enable it for your organization and you have to configure your personal settings.

Enable Social Accounts, Contacts, and Leads

In the organization you’re using for this module, enable the feature.
  1. From Setup, click Customize | Social Apps Integration | Social Accounts and Contacts | Settings.
  2. Select Enable Social Accounts and Contacts.
  3. Select the social networks that your organization can use. By default, all social networks are selected.
  4. Click Save.
  5. Let your users know that they can configure Social Accounts, Contacts, and Leads for their individual use.

Configure Social Accounts, Contacts, and Leads

  1. At the top of any page on the full Salesforce site, click the down arrow next to your name. From the menu under your name, select Setup or My Settings—whichever one appears.
  2. From the left pane, select one of the following:
    • If you clicked Setup in step 1, select My Social Accounts and Contacts | Settings.
    • If you clicked My Settings in step 1, select Display & Layout | My Social Accounts and Contacts.
  3. Set up Social Accounts and Contacts so that it works the way you want it to.
  4. Click Save.

Best Practices for Managing Accounts and Contacts

Establish naming conventions for accounts
If you don’t already have standards for account names, now is a great time to establish some. It’s important to consider how best to record an account’s name, and how you can use naming to denote relationships between accounts. For example, if you work with multiple franchises, you might need to use names that make sense in a hierarchy but also help you differentiate between two stores with the same name in a similar geographic area.
Don’t allow orphan contacts
Always associate contacts with an account. Contacts without accounts—private contacts—are like a forgotten boat adrift at sea. They’re hidden from all users except their owner and system administrators, which makes them easy to forget, hard to find, and useless to colleagues.
Audit your accounts and contacts
Use exception reporting in Salesforce to find accounts and contacts without activities in the last 30, 60, or 90 days.
Or create an “inactive” checkbox field on your account and contact objects, and use mass update to denote inactive accounts. Set up an automated process to mark accounts and contacts inactive for you, based on criteria you specify.
Handle inactive accounts and contacts
After you’ve located inactive accounts and contacts, you can handle them in many different ways. For example,
  • Organize an outreach campaign to re-engage with them.
  • Exclude them from list views, reports, automated processes, campaigns, and more so you can focus marketing, sales, and service efforts on active customers .
Maintain active ownership
It’s hard to actively manage an account if it’s assigned to someone who isn’t using Salesforce. When an employee moves to a different position or leaves your company, assign that person’s accounts and contacts to new owners.
Keep your records updated
Use features like Social Accounts, Contacts, and Leads; Stay-in-Touch requests; and Data.com to gather up-to-date information. Make it a policy that all updated data is entered into Salesforce.

Sunday, May 31, 2015

HOW TO CONVERT STRING TO DATE IN SALESFORCE

THE FOLLOWING IMAGE SHOWS THE STRING FORMAT OF JAVASCRIPT

CONVERSION CODE IS HERE

Map <String, Integer> monthNames = new Map <String, Integer> {'Jan'=>1, 'Feb'=>2, 'Mar'=>3, 'Apr'=>4, 'May'=>5, 'Jun'=>6, 'Jul'=>7, 'Aug'=>8, 'Sep'=>9, 'Oct'=>10, 'Nov'=>11, 'Dec'=>12};

extendAppEnd = 'Sun May 31 2015 09:30:00 GMT+0000';

//split the string based on spaces first
List <String> stringParts = extendAppEnd.split(' ');

The list after spliting like the follow values

/*stringParts[0] = 'Sun'
stringParts[1] = 'May'
stringParts[2] = '31'
stringParts[3] = '2015'
stringParts[4] = '09:30:00'
stringParts[5] = 'GMT+0000' */

//and split the time string based on ( : ).
List <String> timeParts = stringParts[4].split(':');
he list after spliting like the follow values

/*timeParts [0] = 09
timeParts [1] = 30
timeParts [2] = 00*/


DateTime dt= DateTime.newInstanceGmt(Integer.valueOf(stringParts[3]), monthNames.get(stringParts[1]), Integer.valueOf(stringParts[2]), Integer.valueOf(timeParts[0]), Integer.valueOf(timeParts[1]), Integer.valueOf(timeParts[2]));

OUTPUT

2015,5,31,09,30,00



Wednesday, May 27, 2015

How To Show Current User Details With Profile Photo In Visualforce Page

Apex Controller Class

public class Result_page
{  
    public string photo{get;set;}
    public string idval{get;set;}
    public string today{get;set;}
   
    public  Result_page ()
    {
        today = DateTime.now().format('EEEEEEEEE')+' '+DateTime.now().format('MMMMMMMMM')+' '+DateTime.now().format('dd')+', '+DateTime.now().format('YYYY');
    }
   
    public void uid()
    {
        system.debug('id value'+idval);
        User u = new User();
        photo = [select SmallPhotoUrl from User where id = :idval].SmallPhotoUrl;
        system.debug('photo value'+photo);
    }  

}


Visualforce Page

<apex:page controller="Result_page" id="pg">
<!-- Define Your Jquery Script To Call Action Function-->
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
    $(document).ready
    (
        function()
        {
            sendid();
         }
     );
</script>
<apex:form >
    <!-- Define Action Function To Send User Id To Controller-->
    <apex:actionFunction name="sendid" action="{!uid}" reRender="user">
        <apex:param name="idv" value="{!$User.Id}" assignTo="{!idval}"/>
    </apex:actionFunction>
    <!-- Design your Page-->
    <apex:outputPanel layout="block" styleClass="bPageTitle" id="user">
        <apex:outputPanel layout="block" style="display:inline;" styleClass="ptBody secondaryPalette">
            <apex:outputPanel layout="block">
                <apex:outputPanel layout="block" style="float:left;margin-right:10px;">
                    <a href="/_ui/core/userprofile/UserProfilePage">
                        <apex:image value="{!photo}" height="40"/>
                    </a>
                </apex:outputPanel>
            </apex:outputPanel>
            <apex:outputPanel layout="block">
                <apex:outputPanel layout="block" style="font-size:16px;color:#015ba7;">
                   <a href="/_ui/core/userprofile/UserProfilePage" style="text-decoration:none;">
                       {!$User.FirstName} {!$User.LastName}
                   </a>
                </apex:outputPanel>
                <apex:outputPanel layout="block" style="font-size:11px;color:#015ba7;margin-top:10px;">
                    {!today}
                </apex:outputPanel>
            </apex:outputPanel>
            <apex:outputPanel layout="block" style="float:right;">
                <apex:outputPanel layout="block" style="">
                    <!-- Define Your Help Links Here -->
                </apex:outputPanel>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:form >

</apex:page>

OutPut


Monday, March 2, 2015

Salesforce Predefined Functions........

Functions

Use functions to transform data from records, perform calculations, or to provide values for Visualforce attributes.
Functions must be used in a Visualforce expression to be evaluated. You can use the following functions in your Visualforce pages.

Date and Time Functions

Note
The date/time data type might not evaluate correctly in formula expressions for Visualforce pages with an API version less than 20.0. It may be incorrectly interpreted as just a date type.
FunctionDescriptionUse
DATEReturns a date value from year, month, and day values you enter. Salesforcedisplays an error on the detail page if the value of the DATE function in a formula field is an invalid date, such as February 29 in a non-leap year.DATE(year,month,day) and replace year with a four-digit year, month with a two-digit month, and day with a two-digit day.
DATEVALUEReturns a date value for a date/time or text expression.DATEVALUE(expression) and replace expression with a date/time or text value, merge field, or expression.
DATETIMEVALUEReturns a year, month, day and GMT time value.DATETIMEVALUE(expression) and replace expression with a date/time or text value, merge field, or expression.
DAYReturns a day of the month in the form of a number between 1 and 31.DAY(date) and replace date with a date field or value such as TODAY().
MONTHReturns the month, a number between 1 (January) and 12 (December) in number format of a given date.MONTH(date) and replace date with the field or expression for the date containing the month you want returned.
NOWReturns a date/time representing the current moment.
The NOW function returns the current date and time in the GMT timezone.{!NOW()} For example:
Today's date and time is: {!NOW()}
produces the following:
Today's date and time is: Mon Jul 21 16:12:10 GMT 2008
Tips
  • Do not remove the parentheses.
  • Keep the parentheses empty. They do not need to contain a value.
  • Use addition or subtraction operators and a number with a NOW function to return a different date and time. For example {!NOW() +5} calculates the date and time five days ahead of now.
  • If you prefer to use a date time field, use TODAY.
NOW()
TODAYReturns the current date as a date data type.
The TODAY function returns the current day. For example, The following markup:
Today's date is: {!TODAY()}
produces the following output:
Today's date is Mon Jul 21 00:00:00 GMT 2008
Tips
  • Do not remove the parentheses.
  • Keep the parentheses empty. They do not need to contain a value.
  • Use addition and subtraction operators with a TODAY function and numbers to return a date. For example {!TODAY() +7} calculates the date seven days ahead of now.
  • If you prefer to use a date time field, use NOW.
TODAY()
YEARReturns the four-digit year in number format of a given date.YEAR(date) and replace date with the field or expression that contains the year you want returned.

Informational Functions

FunctionDescriptionUse
BLANKVALUEDetermines if an expression has a value and returns a substitute expression if it does not. If the expression has a value, returns the value of the expression.BLANKVALUE(expressionsubstitute_expression) and replaceexpression with the expression you want evaluated; replacesubstitute_expression with the value you want to replace any blank values.
ISBLANKDetermines if an expression has a value and returns TRUE if it does not. If it contains a value, this function returns FALSE.ISBLANK(expression) and replace expression with the expression you want evaluated.
NULLVALUEDetermines if an expression is null (blank) and returns a substitute expression if it is. If the expression is not blank, returns the value of the expression.NULLVALUE(expressionsubstitute_expression) and replaceexpression with the expression you want to evaluate; replacesubstitute_expression with the value you want to replace any blank values.
PRIORVALUEReturns the previous value of a field.PRIORVALUE(field)

Logical Functions

FunctionDescriptionUse
ANDReturns a TRUE response if all values are true; returns a FALSE response if one or more values are false.
The following markup displays the word “Small” if the price and quantity are less than one. This field is blank if the asset has a price or quantity greater than one.
{!IF(AND(Price < 1,
   Quantity < 1),
   "Small", null)}
You can use && instead of the word AND in your Visualforce markup. For example, AND(Price < 1, Quantity < 1) is the same as (Price < 1) && (Quantity < 1).
  • Make sure the value_if_true and value_if_false expressions have the same data type.
AND(logical1,logical2,...) and replace logical1,logical2,... with the values that you want evaluated.
CASEChecks a given expression against a series of values. If the expression is equal to a value, returns the corresponding result. If it is not equal to any values, it returns the else_result.CASE(expression,​value1result1value2,​ result2,...,​else_result) and replace expression with the field or value you want compared to each specified value. Replace each value and result with the value that must be equivalent to return the result entry. Replace else_result with the value you want returned when the expression does not equal any values.
IFDetermines if expressions are true or false. Returns a given value if true and another value if false.
The following markup returns “Private” if the opportunity IsPrivate field is set to true; it returns “Not Private” if the field is set to false.
{!IF(opportunity.IsPrivate, "Private", "Not Private")}
IF(logical_testvalue_if_truevalue_if_false) and replace logical_test with the expression you want evaluated; replacevalue_if_true with the value you want returned if the expression is true; replacevalue_if_false with the value you want returned if the expression is false.
ISCHANGEDCompares the value of a field to the previous value and returns TRUE if the values are different. If the values are the same, this function returns FALSE.ISCHANGED(field) and replace field with the name of the field you want to compare.
ISNEWChecks if the formula is running during the creation of a new record and returns TRUE if it is. If an existing record is being updated, this function returns FALSE.ISNEW()
ISNUMBERDetermines if a text value is a number and returns TRUE if it is. Otherwise, it returns FALSE.ISNUMBER(text) and replace text with the merge field name for the text field.
NOTReturns FALSE for TRUE and TRUE for FALSE.
The following markup returns the value of ReportAcct if the accountIsActive field is set to false. It returns the value of SaveAcct if IsActiveis set to true.
{!IF(NOT(Account.IsActive)ReportAcct, SaveAcct)}
You can use ! instead of the word NOT in your Visualforce markup. For example, NOT(Account.IsActive) is the same as!Account.IsActive).
NOT(logical) and replace logical with the expression that you want evaluated.
ORDetermines if expressions are true or false. Returns TRUE if any expression is true. Returns FALSE if all expressions are false.
The following markup will return the value of VerifyAcct if either account field IsActive__c or IsNew__c is set to true.
{!IF(OR(Account.IsActive__c, 
   Account.IsNew__C)) 
   VerifyAcct, CloseAcct)}
You can use || instead of the word OR in your Visualforce markup. For example, OR(Price < 1, Quantity < 1) is the same as ((Price < 1) || (Quantity < 1)).
OR(logical1logical2...) and replace any number of logical references with the expressions you want evaluated.

Math Functions

FunctionDescriptionUse
ABSCalculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign.ABS(number) and replace number with a merge field, expression, or other numeric value that has the sign you want removed.
CEILINGRounds a number up to the nearest integer.CEILING(number) and replace number with the field or expression you want rounded.
EXPReturns a value for e raised to the power of a number you specify.EXP(number) and replace number with a number field or value such as 5.
FLOORReturns a number rounded down to the nearest integer.FLOOR(number) and replace number with a number field or value such as 5.245.
LNReturns the natural logarithm of a specified number. Natural logarithms are based on the constant e value of 2.71828182845904.LN(number) and replace number with the field or expression for which you want the natural logarithm.
LOGReturns the base 10 logarithm of a number.LOG(number) and replace number with the field or expression from which you want the base 10 logarithm calculated.
MAXReturns the highest number from a list of numbers.MAX(numbernumber,...) and replace number with the fields or expressions from which you want to retrieve the highest number.
MINReturns the lowest number from a list of numbers.MIN(numbernumber,...) and replace number with the fields or expressions from which you want to retrieve the lowest number.
MODReturns a remainder after a number is divided by a specified divisor.MOD(numberdivisor) and replace number with the field or expression you want divided; replace divisor with the number to use as the divisor.
ROUNDReturns the nearest number to a number you specify, constraining the new number by a specified number of digits.ROUND(numbernum_digits) and replace number with the field or expression you want rounded; replace num_digits with the number of decimal places you want to consider when rounding.
SQRTReturns the positive square root of a given number.SQRT(number) and replace number with the field or expression you want computed into a square root.

Text Functions

FunctionDescriptionUse
BEGINSDetermines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does not.
The following markup will return true if the opportunity StageName field begins with the string “Closed”. Standard stage names “Closed Won” and “Closed Lost” would both return true.
   {!BEGINS(opportunity.StageName, 'Closed')}
 
This function is case sensitive so be sure your compare_text value has the correct capitalization. Also, this function only works with text, not with numbers or other data types.
BEGINS(text, compare_text) and replace text, compare_text with the characters or fields you want to compare.
BRInserts a line break in a string of text.BR()
CASESAFEIDConverts a 15-character ID to a case-insensitive 18-character ID.CASESAFEID(id) and replace id with the object’s ID.
CONTAINSCompares two arguments of text and returns TRUE if the first argument contains the second argument. If not, returns FALSE.
The following example checks the content of a custom text field named Product_Type and returns “Parts” for any product with the word “part” in it. Otherwise, it returns “Service.”
{!IF(contains(opportunity.Product_Type__c, "part"), "Parts", "Service")}
This function is case sensitive so be sure your compare_text value has the correct capitalization.
CONTAINS(textcompare_text) and replace text with the text that contains the value of compare_text.
FINDReturns the position of a string within a string of text represented as a number.FIND(search_texttext[, start_num]) and replacesearch_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.
GETSESSIONIDReturns the user’s session ID.GETSESSIONID()
HTMLENCODEEncodes 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 &gt;.{!HTMLENCODE(text)} and replace text with the merge field or text string that contains the reserved characters.
ISPICKVALDetermines if the value of a picklist field is equal to a text literal you specify.ISPICKVAL(picklist_fieldtext_literal) and replace picklist_field with the merge field name for the picklist; replace text_literal with the picklist value in quotes. text_literal cannot be a merge field or the result of a function.
JSENCODEEncodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (\), before unsafe JavaScript characters, such as the apostrophe (').{!JSENCODE(text)} and replace text with the merge field or text string that contains the unsafe JavaScript characters.
JSINHTMLENCODEEncodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe JavaScript characters. JSINHTMLENCODE(someValue) is a convenience function that is equivalent toJSENCODE(HTMLENCODE((someValue)). That is, JSINHTMLENCODE first encodes someValue withHTMLENCODE, and then encodes the result with JSENCODE.{!JSINHTMLENCODE(text)} and replace text with the merge field or text string that contains the unsafe JavaScript characters.
LEFTReturns the specified number of characters from the beginning of a text string.LEFT(textnum_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the left you want returned.
LENReturns the number of characters in a specified text string.
{!LEN(Account.name)} returns the number of characters in the Account name. LEN counts spaces as well as characters. {!LEN("The Spot")} returns 8.
LEN(text) and replace text with the field or expression whose length you want returned.
LOWERConverts all letters in the specified text string to lowercase. Any characters that are not letters are unaffected by this function. Locale rules are applied if a locale is provided.LOWER(text, [locale]) and replace text with the field or text you wish to convert to lowercase, and locale with the optional two-character ISO language code or five-character locale code, if available.
LPADInserts characters you specify to the left-side of a text string.
LPAD(textpadded_length[, pad_string]) and replace the variables:
  • text is the field or expression you want to insert characters to the left of.
  • padded_length is the number of total characters in the text that will be returned.
  • pad_string is the character or characters that should be inserted.pad_string is optional and defaults to a blank space.
If the value in text is longer than pad_stringtext is truncated to the size of padded_length.
MIDReturns the specified number of characters from the middle of a text string given the starting position.MID(textstart_numnum_chars) and replace text with the field or expression to use when returning characters; replacestart_num with the number of characters from the left to use as a starting position; replace num_chars with the total number of characters to return.
RIGHTReturns the specified number of characters from the end of a text string.RIGHT(textnum_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the right you want returned.
RPADInserts characters that you specify to the right-side of a text string.
RPAD(textpadded_length[, 'pad_string']) and replace the variables:
  • text is the field or expression after which you want to insert characters.
  • pad_length is the number of total characters in the text string that will be returned.
  • pad_string is the character or characters that should be inserted.pad_string is optional and defaults to a blank space.
If the value in text is longer than pad_stringtext is truncated to the size of padded_length.
SUBSTITUTESubstitutes new text for old text in a text string.SUBSTITUTE(textold_textnew_text) and replacetext with the field or value for which you want to substitute values,old_text with the text you want replaced, and new_text with the text you want to replace the old_text.
TEXTConverts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom buttons and links.TEXT(value) and replace value with the field or expression you want to convert to text format. Avoid using any special characters besides a decimal point (period) or minus sign (dash) in this function.
TRIMRemoves the spaces and tabs from the beginning and end of a text string.TRIM(text) and replace text with the field or expression you want to trim.
UPPERConverts all letters in the specified text string to uppercase. Any characters that are not letters are unaffected by this function. Locale rules are applied if a locale is provided.UPPER(text, [locale]) and replace text with the field or expression you wish to convert to uppercase, and locale with the optional two-character ISO language code or five-character locale code, if available.
URLENCODEEncodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax. For example, blank spaces are replaced with %20, and exclamation points are replaced with %21.{!URLENCODE(text)} and replace text with the merge field or text string that you want to encode.
VALUEConverts a text string to a number.VALUE(text) and replace text with the field or expression you want converted into a number.

Advanced Functions

FunctionDescriptionUse
GETRECORDIDSReturns 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(object_type)} and replace object_type with a reference to the custom or standard object for the records you want to retrieve.
INCLUDEReturns content from an s-control snippet. Use this function to reuse common code in many s-controls.{!INCLUDE(source, [inputs])} and replace source with the s-control snippet you want to reference. Replace inputs with any information you need to pass to the snippet.
LINKTOReturns a relative URL in the form of a link (href and anchor tags) for a custom s-control or Salesforce page.{!LINKTO(labeltarget,​ id, [inputs], [no override]}​and replace label with the text for the link, target with the URL, and id with a reference to the record. Inputs are optional and can include any additional parameters you want to add to the link. The no override argument is also optional and defaults to “false.” It applies to targets for standard Salesforcepages such as $Action.Account.New. Replace no override with “true” when you want to display a standard Salesforce page regardless of whether you have defined an override for it elsewhere.
REGEXCompares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it returns FALSE. A regular expression is a string used to describe a format of a string according to certain syntax rules.REGEX(textregex_text) and replace text with the text field, andregex_text with the regular expression you want to match.
REQUIRESCRIPTReturns a script tag with source for a URL you specify. Use this function when referencing the Force.com AJAX Toolkit or other JavaScript toolkits.{!REQUIRESCRIPT(url)} and replace url with the link for the script that is required.
URLFORReturns a relative URL for an action, s-control, Visualforce page, or a file in a static resource archive in a Visualforce page.
This can be used to return a reference to a file contained in a static resourcearchive (such as a .zip or .jar file). {!URLFOR(resourcepath)} Replaceresource with the name of the static resource archive expressed as a merge variable (for example, $Resource.resourceName), andpath with the local path to the file in the archive that you want to reference.
{!URLFOR(targetid, [inputs], [no override])} and replace target with the URL or action, s-control, or static resource merge variable, id with a reference to the record, and inputs with any optional parameters. The no override argument is also optional and defaults to “false.” It applies to targets for standard Salesforce pages such as $Action.Account.New. Replace no override with “true” when you want to display a standard Salesforcepage regardless of whether you have defined an override for it elsewhere.
To access a Visualforce page, simple enter the name of your page preceeded by an “apex/.” For example, if your Visualforce page is named myTestPage, you would use {!URLFOR("apex/myTestPage"}.
VLOOKUPReturns a value by looking up a related value on a custom object similar to theVLOOKUP() Excel function.VLOOKUP(field_to_returnfield_on_lookup_object,lookup_value) and replace field_to_return with the field that contains the value you want returned, field_on_lookup_object with the field on the related object that contains the value you want to match, and lookup_value with the value you want to match. You can only use VLOOKUP() in validation rules. If the function fails because, for example, the field_on_lookup_object doesn’t exist, you can specify an error message in the validation rule itself.

Encoding Functions

FunctionDescriptionUse
HTMLENCODEEncodes 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 &gt;.{!HTMLENCODE(text)} and replace text with the merge field or text string that contains the reserved characters.
JSENCODEEncodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (\), before unsafe JavaScript characters, such as the apostrophe (').{!JSENCODE(text)} and replace text with the merge field or text string that contains the unsafe JavaScript characters.
JSINHTMLENCODEEncodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe JavaScript characters.JSINHTMLENCODE(someValue) is a convenience function that is equivalent to JSENCODE(HTMLENCODE((someValue)). That is,JSINHTMLENCODE first encodes someValue with HTMLENCODE, and then encodes the result with JSENCODE.{!JSINHTMLENCODE(text)} and replace text with the merge field or text string that contains the unsafe JavaScript characters.
URLENCODEEncodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax. For example, blank spaces are replaced with %20, and exclamation points are replaced with %21.{!URLENCODE(text)} and replace text with the merge field or text string that you want to encode.