Salesforce Interview Q & A Series Part-II

Hello All, I am here with the next part of Questions and answers series.

16 – Difference b/w trigger and workflow?

workflow rule:- It is an automated process that fired an action based on evaluation criteria and rule criteria.

We can access a workflow across the object.

We can not perform DML operation on Related Objects. Only Master Object field can be updated in case of Master-Details Relationship.

We can not query the database.

Workflow action:- Email alert, Create task, field update, outbound email message

Trigger: – it is a piece of code which executed when the record is before and after of created, updated, deleted and after the record is undeleted from the recycle bin.

We can query the data from the database.

We can Query other related Objects and also can make DML on the same and related objects as well.

Unlike workflow, we can perform any task using apex trigger.

17 – What are Wrapper Classes in Salesforce? Give an example where you can use wrapper class!

A wrapper class in Salesforce is a Container Class which contains Objects, Collection of Objects, variables, Collection of other classes as its member. We can also say that a wrapper class is a custom object that Programmer defines to achieve the business need and defines the properties inside the class.

Example: – We can use the Wrapper class in the following scenarios

a) In the Visualforce community boards, one of the most commonly asked questions is, “How can I display a table of records with a checkbox and then process only the records that are selected?”.

Wrapper Class

b) OR we can use Wrapper class when we want to show the list of data in VF page or in any other classes of the many objects that are not related to each other.

18 – Difference b/w SOQL and SOSL?

SOQL: Salesforce Object Query Language, we can query all the fields, search one object at a time, perform DML operation on the query result.

Total number of records retrieved by SOQL queries – 50K

SOSL: Salesforce Object Search Language, we can query only text, number, email type fields, we can search for the different object at a time. If we are looking for the particular text that is available in any objects then we use SOQL like global search in salesforce and we can not make DML on the returned list.

Total number of records retrieved by a single SOSL query – 2000

Introduction to SOQL and SOSL

19 – Difference b/w Insert and Database.insert?

Insert – Insert and Database.insert method are same but Database.insert method provide you more flexibility as compared to Insert Method. If there is any exception while making DML using insert then All records will be aborted.

Database.Insert – Using Database.Insert method you can specify whether you wanted to abort the complete records when there is an error in any records or commit the success record and show a list of failed records. It also provides the Rollback functionality.

20 – What is the static resource?

Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files.

A single static resource can be up to 5 MB in size, and an organization can have up to 250 MB of static resources, total.

Creating a Static Resource

21 – How to call javascript through Static Resource on VF page?

<apex:includeScript value=”{!$Resource.Myscript}”/>

22 – What are workflow Actions in Salesforce?

Create a Task, Update a field, Email alert, Outbound message.

23 – How many ways we can be made field is required?

From Layout, Validation rule, at the time of Field creation.

24 – Difference b/w role and profile?

R for records means Role deals with records level security and Profile deals with Object Level access.

profiles control object – and field-level access

Roles influence record-level access

A role is the record level access and it is not mandatory for all the users.

The Profile is the object and field level access and it is mandatory for all the users.

25 – Difference b/w rendered, rerender, renderaspdf?

Rendered: – To show/hide the particular panel, field based on conditions. for example, if input 1 is not blank then show input 2 here we can use Rendered

Rerender: – Used for refresh the Output Panel

RenderasPdf: – To open the Vf page as PDF format

26 – What are standard Junction Object present in Salesforce?

OpportunitycontactRole, Pricebook Entry, Opportunity product

27 – Difference b/w action support, Action function?

ActionSupport ActionFunction
1) Directly call action method without javascript Call action method from javascript with AJAX
2) It can be used to call action method on  single event It can be used to call action method on different event
3) It can not be called from javascript function.It only invokes controller action methods from other Visualforce components It defines a new JavaScript function which can then be called from within a block of JavaScript code.

28 – How many controllers can be used on VF page?

Salesforce comes under Saas so we can use one controller and as many extensions

29 – Can we create Master-Detail relationship in the Object which already have existing records?

Directly we cannot create. But, If we want to create then we need to do the following steps

  1. Create a Lookup relationship field on the Object
  2. Fill all the Lookup values with the correct master records ids
  3. Then Go back to the lookup field and then change From Lookup to Master-Detail

30 – Can we convert Master-Detail field to Lookup field?

Yes, we can but if Master Object does not have any Rollup Summary field then only we can.

31 – Is it possible to delete junction – Object in case of Mater – Detail Relationship?

If the parent objects don’t have Roll up Summary fields for the child object then we can delete.

To delete a child object it should not be referred to Apex Classes and Apex Triggers.

Later if we undelete the object, Master-detail fields on the junction objects will be converted to look up Fields.


If we delete only Master-Detail Relationship field from the child object and undelete it from the Recycle Bin then it will be converted to look up the relationship.Parent Object we cannot delete because it will be referred

Parent Object we cannot delete because it will be referred in the child object.

32 – What will happen if we undelete the deleted Junction Object?

Master-Detail Relationship data types will be converted to look up related data types.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s