Salesforce Automation Examples :In our previous Salesforce Training Tutorial we have learned about what is Sales Force Automation. In this Salesforce Tutorial we are going to learn about the process of deriving year and Month values from opportunity close date. This is a Salesforce Automation example in salesforce.com.

Salesforce Automation Example

Deriving Year and Month values for Opportunity close is one of the example for Sales Force Automation. This is a simple format for dates for presentation of  reports. In Salesforce we use Date element to represent Year and Month values.

Standard Date field called CloseDate is used to derive Year and Month values as text values on the Opportunity record detail page.

To derive year and Month values follow the steps given below.

Go to Setup=>Customize=>Opportunities=>Fields.

Salesforce Automation Examples

Select Fields as shown above and Select New Button.

Salesforce Automation Examples

Go to Opportunity Custom Fields and Relationships section Select New Button as shown above.

Select Formula as Data Type and select Next.

Salesforce Automation Examples

Now Enter Field Label as Close Date Year Month and the Filed name will be automatically filled.

Select Formula return type as Text.

Salesforce Automation Examples

Enter the code as shown above in the editor box.

In Blank Field handling select Treat blank fields as blanks and Select Next.

Salesforce Automation Examples

In field Level Security Select visible to every profile and Finally click on Save button.

 Testing the code.

Now go to any opportunity record and open in detailed view.

Successfully we have derived year and month values for the opportunity close date using formula field.