Saturday, 18 November 2017

All you need to know about creating reports in salesforce

Salesforce gives a powerful option for generating reports on the data stored within salesforce in custom and standard objects. The wealth of information can be filtered, grouped sorted using reports. The data displayed on the reports is as per the user security access. Reports are stored within folders. A user can run the report if it has access to the folder where report is stored. In this post we will see how to create custom reports in salesforce, different report formats, and other features of reports that are available for usage.

creating reports in salesforce

A report is a list of records which meet your defined criteria. Records are displayed in rows and fields in columns. Reports can be filtered, grouped or ordered as per the business requirements. Reports are to be stored in folders which can be public, hidden, or shared and can be read only or read write type. Folders access can be controlled using roles, permissions, public groups and license types. Before building a report an important think to consider is "Report Type". Once you have finalized the requirements you need validate whether you have a report type that suits your requirements.

Report Type:
creating reports in salesforce needs that you identify your requirements and then determine the report type for it. Report type is a skeleton using which reports are to be built. Custom report types let you to create a new framework in the report wizard, using which administrators can build and customize reports as per needs. Reports type defined which fields are available for use in a report. 

There are two type of report types that is the standard report or the custom report. Standard report types gives access to most of the standard objects while custom report types gives access to custom objects and custom views of standard objects. While creating a new report you need to select a report type and then start building the report. 

Depending on how your report type is structured you will have options to drag fields on to your report. In report type you need to define the primary object and related object fields which you will need while building the report. A report will display records that meet the criteria set in the report type hence it is important to create proper report type before building the actual report. Salesforce also provides lots of standard report types which can be used in building new reports.

To create a new custom report type you need to:
>> Navigate to set up, and search for Report type under create.
>> Click onNew Report Type

creating reports in salesforce

>> Then need to select th primary object that you need for your report, give in description, name, category for the repprt type and click next.

>> The next step is to define the records set that is defining your related objects and then click on save.

how to make reports in salesforce: 

creating reports in salesforce

Before building a report you need to define your requirements, identify the objects which will be needed for building the report, check if there are any standard report types that provides all the objects needed, if not create a new report type and start building the report. Next thing will be define the filter criteria, group, order as per requirements. A user needs to have Create and Customize Reports AND Report Builder permission in order to create, delete or customize reports.

For creating reports in salesforce follow below steps. 

>> Go to Reports tab , select report type depending on your needs and click create

creating reports in salesforce

>> You need to select the type of Report you want to build that is you need to select the report format, this will depend on what your requirements are. There are four different format of report that you can have and those are tabular, summary, Matrix and Joined reports. A Section below has all the details about each of the report types.

>> Next thing to do within report builder is setting the criteria for displaying the records. Here you can select date range for different date fields of the object. Also you can drop fields in filter criteria area and build your own criteria for which you can use different logical operators as well.

creating reports in salesforce

>> Next thing that you can do is group your data either in rows or columns in case of summary, matrix or joined reports
>> Next you can run report to see if it working as per your needs and then save the report in desired folder.

While above are basic steps in building reports in salesforce you can customize your reports using other things like bucket fields, summary fields, subtotaling, smart totaling, joining reports using joined reports, building dashboards using the reports (except for tabular format).

While creating reports you need to select the format of the report. Below are the different Types of Reports and their details.

creating reports in salesforce

1. Tabular.
Tabular report format is a simplext of all and very easy and fast to build. As its names suggests it a simple tabular display of record just like a spredsheet. Its a simple way at looking rows of records with ordered set of fields in columns. Tabular reports give a simple subtotal at the end of the report. These type of reports canot be used for grouping of data or for dashboards.

2. Summary:
Sumamry reports are similar to tabular reports but these allow grouping rows of data. Also you can view subtotals and you can create charts in this type of reprots. Unlike tabular reports you can use summary reprots as source for building dashboards. If yu dont use grouping in this reports it looks exactly same as tabular report.

3. Matrix:
Matrix reports are little enhanced and are similar to summary report with a difference that you can summarize on both rows as well as columns. Like summary reports this can also be used as source for building dashboards.

4. Joined Reports:
Joined reports are the most enhanced ones and were incorporated the last in the list of report formats. With joined reports you can have multiple report blocks that gives different view of data. Each block here acts like a separate sub report with its own fields, columns, filtering and sorting. A joined report can also contain data from different report types.

You can change an already saved report format but that may impact few things and you need to go through the salesforce documentation before you change the format.

Bucket Fields:

creating reports in salesforce

Bucket field in salesforce reports helps you quickly categorize records without having to create new formula or custom fields. With bucket field you can define multiple buckets which can be used to group report values. To build a bucket field you need to drag the bucket field on report and then define the bucket values as per need.

All you need to know about creating an email template in salesforce

email templates salesforce
Every firm needs to have email templates designed so that communications are properly managed. Email templates assist an organisation to deal properly with the leads,users and contacts of the accounts. Email templates properly branded are essential for creating long term and lasting impacts on the recipients. Emails should be readable and at the same time should be able to reflect the companies brand when sending emails to people outside of the organisation.

Using templates can save time and help in standardising the emails that are sent. In salesforce you can create your own templates or use the ones already created by other users. You can also use the sample templates provided by salesforce. To send an email you can go to the record, open the activity tab and then click the email tab. Select the template you want, preview the content, edit as needed and send the mail.
Email template in salesforce allows to create predefined email templates that can be sent to contacts, leads and others. To create new email template you need to navigate inset to >> Communicate Templates >> Email Templates >> Click on New Template

email templates salesforce

There are four different types of email templates that can be created in salesforce. Below are the four types:
1. Text
2. HTML using Letterhead
3. Custom without using Letterhead
4. Visualforce

These are plain text emails which can be sent to those who cant read HTML and prefer plain text emails. These can also include merge fields. To include merge fields you need to select the object first and then the field , this gives the merge field expression which is to be copied in the email template body as seen in below screenshot. All users have the ability to create or modify an email template.

In order to create an HTML templates based on letterhead user needs to have "EDIT HTML Templates" permission on the profile. The look and feel of this type of template is defined by the letterhead used. Logo, colour and text are inherited from the letterhead of the template.

email templates salesforce

While creating a new HTML letter template you need to select a existing letterhead and also need to use proper email layout as per your needs. The folder where you want the template to reside has also to be selected.

email templates salesforce

Custom HTML :
User need to have "Edit HTML Templates" permissions in order to create custom HTML templates. This kind of template is to built with HTML so you need to know the HTML or obtain the HTML code and insert it in the body. In this case you need not use pre existing letterhead and need to build the whole template using HTML

Visualforce Templates:
This type of email templates can be created by administrators and developers. This type of email templates allow for advanced merging and can contain data from multiple records. Sending mass email using visualforce email template is not allowed. Visualforce email template allow for dynamic content like recipient location or type, it also has multilingual support. Visualforce templates allow dynamic attachment based on salesforce data.

email templates salesforce

The visualforce email template content has to be written with in components <messaging:emailTemplate> </messaging:emailTemplate>. There are other components that has to be used for writing the either plain text or HTML body. Component for including attachments, email header.

Note below things while creating an email template in salesforce.
1. You need to mark the template as Available for Use else you wont be able to use it for communication.
2. You can send test mail to user, related record or an email id to test the mail and check for merge fields.

email templates salesforce

Text, Custom HTML, and Letterhead email templates can be used in Lightning Experience however you cant use visualforce email template in Lightning experience.

Considerations while using salesforce classic templates in lightning experience.
- In order to display classic email templates you must include templateId field in the lightning email action layout.
- Attachment are read only in lightning experience and cant be added or removed.
- Externally Linked CSS files are not supported.

Text Emails: Both subject and Body can be edited.
Custom HTML Template:  You cant edit the subject or body
Letterhead email template: You can edit subject but cant edit header and footer

Saturday, 28 October 2017

Salesforce Interview Question and answers for Developers Part 9

49. What is the significance of master detail relationship?
Ans - Master detail relationship can be set by creating master detail field on the detail object. In master detail relationship whenever a master detail record is deleted the detail records are also deleted. When creating a detail record it is mandatory that the master field is populated with a value(i.e master field is mandatory) It is also mandatory that this field is kept on pagelayout. A standard object can never be set as detail object. With master detail relationship roll up summary fields can be created on master object.

50. What is trigger recurssion and how can you you avoid it?
Ans - If an exceting trigger calls itself then it goes to into infinite loop and is called recursion. If a trigger on a particular object executing on a particular dml does the same dml on that object then the same trigger would be called and it will go into recursion. A static variable can be set in a class before executing the trigger to avoid the recursion.

51. What is an external id?
A external id is field that can be used as a reference while updating records. If the data is coming from an external system then the unique field that the external system has could be used as an external id within salesforce. External id can be used while upserting records within salesforce using data loader. There is a limit on the number external ids you can have in an object.

52. What are governers limit and what is its significance?
Ans - Governers limit is a limit that salesforce enforces on every code execution so as to avoid monopoly by any single org. Since the resources are shared across organisation governer limit checks on the resource utilisation. Number of limits are imposed limit 100 soql query exception, 50000 rows can be fetched using soql etc

53. Why one should not put a soql or a dml within for loop?
Ans - Putting soql or dml in for loop can easily hit the governer limit hence we should not put them in for loop. Only 100 soql are allowed in one transaction and only 150 dmls are allowed.

54. What are the various collections available in salesforce?
Ans - In salesforce along with primitive data types and sObjects there are collections. Apex uses following collections as below
    List - stores duplicate values which are ordered.
    Set - stores unique values which are unordered
   Map - consists of keys and values

Salesforce Developer Interview Question and answers part 8

 Next>>> Part 9[Questions 49-54]

43. What is the significance of ID data type in salesforce?
Ans - Every record in salesforce is represented using a parameter called as id. Salesforce uses Data type ID for storing such record id's. An ID is represented in terms of 15 digit or 18 digit. 15 digit id is case sensitive where as 18 digit id is case insensitive. First 3 characters of ID indiacte the object for example 001 means its an account record or 006 means its an opportunity record.

44. What is the difference between a List and Set?
Ans - A List and Set are both collections similar to array with following differences
 List can store duplicate values in it, set can store only unique values
List can store primitive types,sObject as well as collections in it,Set can store primitive and sObjects but not collection
List is Ordered where as set is unordered.

45. What are the various primitive data types available in salesforce?
Ans - Various primitive data types in apex include following
  Decimal, double, integer, Long, String, Id, date. datetime, time, currency, boolean

46. What is a map collection? and how is it different from list and set?
Ans - A map consists of key and values. Keys are unique while values can be duplicated. Every key points to a value. Using methods we can retrieve the values using the keys or store key-values mappings. map is useful in storing relationships between to parameters. Key is similar to set which can only store primitive types where as values are like set that can also store collections in it. There are number of methods that can be used to manipulate data in map.

47. What is an sObject data type?
Ans - sObject is a data type that can store standard or custom object in it. Account for example is a sObject type of data.
ex-   sObject sO = new account()

48. What is a sandbox.? what are the different types available?
Ans - sandbox is a test environment used for developing or testing the functionality. It is an exact copy of your production org. Sandbox can be full sandbox, Developer sandbox, Developer Pro, Partial Data sandbox

 Next>>> Part 9[Questions 49-54]