0% found this document useful (0 votes)
2K views20 pages

SFDC Scenario Based Iquestions

The document provides answers to various Salesforce scenario-based interview questions. The questions cover topics like sharing and permissions, workflow rules, bulk data operations like deleting records, pagination, Apex triggers and handler classes. Appropriate solutions are proposed for each scenario based on Salesforce concepts around profiles, permission sets, triggers, future methods, batch apex etc.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views20 pages

SFDC Scenario Based Iquestions

The document provides answers to various Salesforce scenario-based interview questions. The questions cover topics like sharing and permissions, workflow rules, bulk data operations like deleting records, pagination, Apex triggers and handler classes. Appropriate solutions are proposed for each scenario based on Salesforce concepts around profiles, permission sets, triggers, future methods, batch apex etc.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

SFDC scenario based interview 

Questions

1) Consider the scenario

 I have a profile by name ‘ProvideReadAccess’ and two users U1 and U2 assigned to it. And I
have object X.
 My Question is I want to have ReadWrite access for U1 and ReadOnly access for U2 for the
object X.
 How do I do this?

Answer:

 Read Access for both users is common hence in the Profile settings give ‘Read’ access for the
object ‘X’
 By doing this User U2 will be able to read all the records( One condition satisfied) but U1 will
also be able to only read the records(Second condition not satisfied).
 So next what do we do is we create a permission set say ‘GrantWriteAccess’ and in this
permission set we give the object ‘X’ the Write access and assign the user U1 to this permission
set.(2nd condition satisfied).

2) Consider the scenario

 I have not given any CRUD permission in the profile ‘P1’ for an object O1, yet I’m able to create
records for object ‘O1’. How could this be possible?

Answer:

 Any permission with respect to creation /deletion/Updating/viewing of object is possible only


through permission set or Profile.
 Meaning If we are able to create records in a object then the Create Permission in either Profile
or in Permission Set should be enables. If its not enabled in the Profile then it has be in the
Permission set.
 So check for the permission set.

3)Consider a scenario

 I have two objects Obj1 and Obj2 which are not related to each other.Now I want to create a
Master Detail Relationship(MDR) between these objects How can I do this?

Answer:

 First choose which object has to be a Parent object(Master) and Child Object(Detail).
 For our understanding lets say for now we decide Obj1 to be Master object and Obj2 to Detail
object.

First lets under stand what’s a Master Detail relation ? Every child should have a parent.
Which means every record in Obj2 should have a related parent record in Obj1. Also One
child can have only one parent. But One parent can have multiple children.
Scenario 1: if there are pre existing records in the Obj2 then?

With the above understanding on Master Detail relation we have to be sure that every record in
Obj2 has a related record in Obj1.

And in our scenario Obj1 and Obj2 are not related to each other. So first we have to create a
basic Look up relation between these two objects so that we can establish a relation between
these two objects.

So we follow below steps

1. we create a Lookup field in the Child Object Obj2 pointing to Obj1 as parent.

2. Update the Lookup field of all the records in Obj2 with a value from the Obj1 (Related field)

3. Then we convert the Look up field to Master Detail relation.

Scenario2: If there are no pre existing records in the Obj2 then?

4)Consider a scenario

 I’m trying to implement Pagination. Initially i want to display 50 records and when user click on
Next button, the records stating from 51 to 100 should get displayed. How do I accomplish this.

Answer:

 The key question here is how do we fetch next 50 records when user clicks on ‘Next’?
 One possible way to implement this is to have ‘OFFSet’ used in SOQL which fetches the
records.

Eg: SELECT Name from Merchandise__c


where Price__c > 5
Order by Name Limit 100
OFFSET 50

5) Consider a scenario

 I have two workflow Rules and two fields F1 and F2.


 When ever F1 is updated to value= 10, WF1 fires and updates F1 value to 20 and F2 value to
30
 When ever F1 values= 20 there is another Workflow WF2 fires which will update F1 to 10 and
F2 to 20
 What will be the outcome of this Workflow rule.

Answer:

 This scenario will cause recursive Workflow rule


 This will exhaust the governor limit and result in error
6)Consider a scenario

 I have a User, Who will leave the organization tomorrow. He is basically a manager and there
are 15 users below him.
 Now when this user leaves the organization I would generally inactivate the User.
 But now my concern is if I inactivate this user What happens to the Role hierarchy? the
assignment rules, Approval processes, the records created by him and records to which he is
the default owner like leads and cases.
 what would be best possible solution to keep this application intact and running and yet have
this user deactivated?

Answer:

 To prevent users from logging into your organization while you perform the steps to deactivate
them, you can freeze user accounts.
 So in this way until you find ways to remove this User from Role hierarchy/assignment
rules/update the Owner of the records created by him / from any place where this user is used,
we can make use of FREEZE button on the user record.

Note:

1. When we click on FREEZE button, the user will not be able to login to the application any
more.

2. Freezing user accounts doesn’t frees the user licenses available for use in your organization.
We have to de activate the user to free the license.

7)Consider the scenario

 I want to delete 20000 records and I don’t want them to be recovered from recycle bin.

OR

 I want to do a mass delete on set of records and don’t what them getting into recycle bin.
 What possible options do I have?

Answer:

 Yes this is possible, Use Hard Delete Option

8)Consider the scenario:

 Let say I have a page which displays the set of records from Account object and I’m using a
standard controller.
 Now I have two users belonging to same Profile. When they login and view this page, they get a
message “Insufficient privileges”.
 What could be the reason for this? Or who would u arrive at a solution?

Answer :
 Notice below points:
 Question speaks about standard Object and Standard Controller.
 Also remember permission to a object is given by Profile.
 So we need to check if the user has permission to read data of this Object.
Only if the permission is given to the user,he’ll be able at access them else he will get an error
message as “Insufficient privileges”

9)Consider the scenario:

 I have Standard Controller and Controller Extension.


 You can write all that logic in Controller Extension which can be written in Custom Controller.
Also both Controller Extension and Custom controller execute in System Mode.
 So Why do we need Custom Controller ?

Answer:

 1st point Controller Extension can’t exist on its own.


 It has to be implemented on a Standard Controller or a custom controller.
 So keeping the above point in mind, Let’s say certain methods needs to be executed in User
Mode and certain in System Mode.
 In this scenario it makes absolute sense to User Standard Controller with Custom Extension.
 Where in using Standard Controller provides all preexisting features of Force.com platform.
 But note that When we use Standard Controller All the Sharing rules, permissions of a user are
respected.
 So if this what we wanted then we should go for an implementation of this sort.
 Other wise if we are building all features on own like Save Edit Update and delete then we
should be using Custom Controller.

1)Why we cannot pass objects as arguments in future method?

==>Object data might change between the time you call the future method and the time it actually
executes.So,we pass record id.

2)IF downtime occurs and future method was running what will happen?

==>The Future method execution will be rolled back and will restart after downtime overs.

3)IF the future method was queued before a service maintenance what will happen?

==>It will remains in queue and when maintenance is over and resources are available it will get
execute.
4) If the batch is executed without the optional scope parameter and If in batch apex suppose we
have 600 jobs and there are total 200 records to be proceeds in each transaction,so in total we
have 3 transaction.If first transaction succeeds but second fails so in this case the records
update done in first transaction are rolled back or not?

==>It will not be rolled back.


5)When to use Database.Stateful   in batch apex?

If we implements Database.Stateful we can maintained state across transactions.


Only instance variable hold values static members does not hold values.

suppose we have 600 jobs and there are total 200 records to be proceeds in each transaction,so if we want to
count records as batch proceeds maintaining state is important as after 200 set of records new transaction will
start and members will loose their values. By implementing 
Database.Stateful we can maintain state after transaction is over and can store previous values.

Syntax:

global class myClass implements Database.Batchable<sObject>, Database.Stateful{

6)What are the parameters in system.schedule(Parameters) represents?

system.schedule('jobName ', expression, instance of schedulable class);

JobName  represents the name for the job,


expression represents time and date at which batch should run,
"instance of schedulable class" represents instance of class  which need to be schedule.

7)With the before Insert event which context variable is correct Trigger.new or
Trigger.newmap?

As the event is before insert only trigger.new will be supported.

Trigger.newmap will not be supported as we do not have id of record before the record is inserted.

8)What will you do if a method inside apex class need to be executed only when it is getting
called from trigger?

We will use trigger.isexecuting in apex class to check if the method inside apex class is getting called from
trigger and will execute the method if getting called from trigger.

9)What will happen if you forgot to store remote site url in remote site setting?

The callout  to external system will fail.

10) How to query object having more than 50,000 records?

The total number of records that can be queried by soql queries is 50,000 record. If we query more than 50,000
record we exceeds the heap limit.

To avoid this we should use SOQL query for loop it can process multiple batches of record using call to query
and query more.

for (List<Account> acct : [SELECT id, name FROM account

                            WHERE name LIKE 'Test']) {


    // Your logic here

}
//A runtime exception is thrown if the below query returns enough records to exceed your heap limit.

Account[] accts = [SELECT id FROM account];


11) Is it possible to call a batch class  from trigger and is it possible to make a call to apex callout
method from trigger?

Yes it is possible to call a batch class from trigger but in case of call to apex callout method the method needs to
be asynchronous.

12) Why we should avoid using SeeAllData=true in test class?

It might happen that the test class pass in sandbox but fails in production if we do not have the same record in
production.

13) If we are using @testSetup in test class and let say we have two test methods in the same test
class which are using the data from @testSetup and performing operations on data, so in this let
say if i am updating data from @testSetup in first test method and also using the data
from @testSetup in  second test method whether i will get the fresh data or the updated data in
second test method.

operation done on the records from @testSetup are local to the test method only, so i will get fresh data in
second test method as well.

Sample example:

@isTest
Public class testclass
{
 @testSetup
 static void testsettingup()
 {
 contact obj=new contact();
 obj.firstname='test';
 obj.lastname='data';
 insert obj;

 }
 static testmethod void testmethodname() //No parameter inside test method
 {
 test.starttest();
 contact obj1=new contact();
 obj1=[Select id,firstname from contact where firstname='test'];

 obj1.firstname='test1';
 update obj1;
// operation done on the records from @testSetup are local to this test method only.
 test.stoptest();
 }
}
14) How many times a test method can call test.starttest() and test.stoptest()?

Each test method can call start test and stop test only once, but number depends on the number of test methods
in test class.
15) What will happen if a class is not declared with "With sharing" or "Without sharing" and it
get called from another class which is declared with "With sharing"?

If we do not declare class with "With sharing" or "Without sharing"  the class will not take into account the
sharing rules but if this class is called from another class which is declared with "With sharing" it will take into
account the sharing rules.

16) IF the class with "With sharing" is calling method of another class with "Without sharing"
what will happen?

IF the class with "With sharing" is calling method of another class with "Without sharing" than the method
inside "Without sharing" class will execute without sharing rules.

17) IF the class with "Without sharing" is calling method of another class with "With sharing"
what will happen?

IF the class with "Without sharing" is calling method of another class with "With sharing" than the method
inside "With sharing" class will execute with sharing rules.

18)Let say user do not have permission on a child object and he is having permission on parent
object to read/create/edit/delete parent object,If I create a trigger on parent object to insert a
child record after parent record is created,will it create a child record or not after user insert
parent record manually?

It will create a child record. (Trigger/apex class runs in system mode)


19)If in (question 18) from trigger I am calling apex class which is in "with sharing" mode and
where i am inserting child record after parent is inserted manually by user so will it create a
child record?

It will create a child record.(With sharing keyword has nothing to do with user permissions).

20) What will happen if we forgot to enable mydomain?

  We must deploy My Domain in our org if you want to use Lightning components otherwise we would not be
able to see the output of lightning components.

  21) What are the different type of pages we can create using lightning component and what are
the 
  different types of component supported in lightning pages?

  We can create different types of pages using lightning app builder,

1)App Page
2)Home Page
3)Record Page

Components type supported in Lightning pages:


1) Standard Components:

Standard components are Lightning components that are built by Salesforce.

2) Custom Components:

Custom components are Lightning components we creates.

3) Third-Party Components on AppExchange

On AppExchange we can find packages containing components that are ready to use in lightning app builder.

  22) What are required parameter while declaring attribute in lightning component?

  Name and type are parameter of attribute which are always required in attributes,description is another
parameter where we can mentioned about description of attribute.Description is not an required attribute.
Similarly we have default parameter to give some default value to attribute.To set the access for an attribute we
have access parameter where we can specify about public,private,global access for an attribute.By default the
attribute have public access.

  23) Which type of attribute we can use in lightning component to store fractional values?

  Doubletype.

  24) When to use Decimal type attribute in lightning component?

  Decimal is better than Double for maintaining precision for floating-point calculations.
  It’s preferable for currency fields.

  25) Let say we are storing some default values in map attribute. 

  <aura:attribute type="Map" name="Mapattribute" default="{1:'value1',2:'value2'}" />

  How to retrieve value from this attribute?

  Retrieve values by using cmp.get("v.Mapattribute")['1'].

  26) To form a container around a information related to single item or group of item what we
need to use in lightning component?

  Lightning:card.
  27) How to obtain the id of the current record in lightning component?

  By using force:hasRecordId interface in lightning component we can assigned the id of the current record to
lightning component. This interface adds an attribute named "recordId" to the component. The type of
attribute is string and has 18-character Salesforce record ID.

  28) you are asked to override the standard action using lightning component how you will
achieve this?

   Lightning:actionOverride  interface Enables a component to be used as an override for a standard action. We


can override the View,New, Edit, and Tab standard actions on most standard and all custom components. The
component needs to implement the interface Lightning:actionOverrideafter which the component appear in the
Lightning Component Bundle menu of an object action Override Properties panel.

 
   29) Which interface you will implement in lightning component if you want your component
to be available only for record detail page?
 
   Interface flexipage:availableForRecordHome make the component available for record pages only.

 
   30) you are asked to create a component for some requirement and create a tab for the same
in lightning experience what you will do to achieve this?
 
   Interface force:appHostable in component allow it to be used as a custom tab in Lightning Experience or the
Salesforce mobile app.

 
   31) On load of lightning component you are required to execute some action what you will do
to achieve this?
 
   We will use "Init" Event which is also called as the constructor of lightning component.The init event is called
once the component construction is over.
 
   Basic Syntax:

<aura:handler  name="init" value="{!this}" action="{!c.doinit}"/>

  32) you are asked to execute some action when value change is detected in one of the attribute
what will you do?

  We will use "change" Event.

  The change event is called when the value in one of the attribute changes.
  As an Example If i am having  attribute " Anyname", on change of attribute "Anyname" if i want to call
javascript method i can do this as:

Syntax:

<aura:attribute name="Anyname" type="String" />


<aura:handler  name="change" value="{!v.Anyname}" action="{!c.doinit}"/>

 33) You are having a requirement to pass value from child component to parent component
which type of event you will use?

 We will use Component event. Component event are used in case when there is a relationship between
component. Component Events are fired by the child components and handled by the parent component.

 34) You are having a requirement to pass value from one component to other component which
are not related but a part of same application which type of event you will use?

 We will make use of Application event. Application event are the event handle by any component no matter
what relationship between them but they should
 be inside single application.

 35) Explain the event propagation rule for application event and component event?

Event Propagation Rules

 36) You are calling child component from Parent component and passing one of the attribute
value from Parent component to child component attribute while calling child. What will you do
if you want to binding both parent and child component attribute?
 
   I will make use of bound expression,
 
AttributeNameFromChild="{!v.AttributeNameFromParent}" is a bound expression. Any change to the value of
the childAttributeName attribute in child component also changes the value of parentAttributeName attribute
in parent component and vice versa.
 
   <aura:component>
   <c:ChildComp childAttributeName="{!v.parentAttributeName}" />
   </aura:component>

 
 37) You are calling child component from Parent component and passing one of the attribute
value from Parent component to child component
 attribute while calling child. What will you do if you do not want to bind parent and child
component attribute?
 
    I will make use of unbound expression,
 
AttributeNameFromChild="{#v.AttributeNameFromParent}" is a Unbound expression. Any change to the
value of the childAttributeName attribute in child component has no effect on the value of
parentAttributeName attribute in parent component and vice versa.
 
     <aura:component>
    <c:ChildComp childAttributeName="{#v.parentAttributeName}" /> 
   </aura:component>

 
   38) You are in a need of passing a value from Parent component controller to Child
component controller what will you do?
 
   We will make use of Aura:method.

39) How to ensure field level security while working with lightning components?

Make use of Lightning:recordForm or Standard controller of lightning component (force:recordData).

40) How to use lightning component with visualforce page?

Make use of lightning Out feature.

41) Lightning component is what type of framework?

It is a component based framework.  It is an event driven architecture. It can called as a MVCC framework
which has two controller, one is client side and other is server side.

42) How to use lightning component with Salesforce mobile app?

Make a tab for lightning component and include this tab in Salesforce1 mobile navigation.

43) What are the requirement to call a server side controller method from Javascript
controller?

Method should be static and must be Aura enabled using @AuraEnabled.

44) We have a requirement to create account using new button and default some values in the
new account screen how we can achieve this requirement?

We can make use of force:createRecord, force:createRecord is an event that opens a page to create a record for
specific entity. 

Sample syntax:

createRecord : function (component, event, helper) {


    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "ObjectApiName"
    });
    createRecordEvent.fire();
}

defaultFieldValues attribute inside setParams let us auto populate value on fields inside record form.

Sample Example to create account:

COMPONENT:

<aura:component implements="flexipage:availableForAllPageTypes">
    <lightning:button label="New Account" onclick="{!c.createAccount}"/>
</aura:component>

CONTROLLER:

({
createAccount : function(component, event, helper) {
        var recordEvent=$A.get("e.force:createRecord");
        recordEvent.setParams({
            "entityApiName": "Account",
            "defaultFieldValues":{
                "Industry":"Apparel"
      }
        });
        recordEvent.fire();
}
})

45) When CRUD operations can be performed by form-based components


like lightning:recordForm, lightning:recordViewForm, lightning:recordEditForm  taking field
level security into consideration so what is the need of force:recordData?

force:recordData is known as standard controller of lightning component similar to we have


standard controller in visualforce page. On its own, force:recordData does not have inbuilt UI. We need to
define the fields for taking inputs. The lack of UI elements makes it a powerful addition. We can use it to create
highly customizable user interfaces beyond what the form-based components provide. We can use custom
components to display the data fetched by force:recordData.

46) What is target attribute  and fields in force:recordData represents?

Sample syntax:

  <force:recordData aura:id="someId"
    recordId="{!v.recordId}"
    layoutType="{!v.layout}"
    fields="{!v.fieldsToQuery}"
    mode="VIEW"
    targetRecord="{!v.record}"
    targetFields="{!v.simpleRecord}"
    targetError="{!v.error}"
/>

target attributes are attributes that force:recordData populates itself.


1) targetRecord is populated with the loaded record
2) targetFields is populated with the simplified view of the loaded record
3) targetError is populated with any errors

fields specifies which fields in the record to query.

47) What is the use of recordUpdated event in force:recordData?

For every force:recordData component referencing the updated record, LDS does two things.

LDS notifies all other instances of force:recordData of the change by firing the recordUpdated event with the
appropriate changeType and changedFields value.

 It sets the targetRecord and targetFields attribute on each force:recordData to the new record value. If
targetRecord or targetFields is referenced by any UI, this automatically triggers a rerender so that the UI
displays the latest data.

Note: If force:recordData is in EDIT mode, targetRecord and targetFields are not automatically updated.

Technical Round-1 and Round-2


 
1. Describe OFFSET and give example and why we use?
Ans- OFFSET is a clause which is used in SOQL query. When using offset only first
batch of records are returned for a given query. If you want to retrieve next batch
you will need to re-execute query with the highest OFFSET Value.
     Example- A query like- [select id, name from Account limit 10 OFFSET 10]
     Then it will return record from 11 to 20.
     
     2. Can we convert lookup in to master-detail relationship and how?
     Ans- Yes , we can convert lookup to master but When we are converting lookup in
to master then any of the lookup fields should not be blank, if there will be blank
then populate values in lookup fields then covert.
 
  

 3. How to find that which record is inserted/ updated in batch class?


     Ans- Use SaveResult class like Database.SaveResult[] srLst=d
atabase.update(lstData, false); and there is isSuccess() method which finds the
successfully record inserted and getError() method used to get error from the
failure record and by using getId() method we can get failure records Id in class.
     4. How to find that which record is inserted/ updated in batch class?
   
     5. How to use rest Api in class?
 
     6. What is custom metadata and how do we use custom metadata?
     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/create-custom-
permission-set-using.html
 
      7. What is difference between profile and permission set?
     Ans- The difference between Profile and Permission Sets is Profiles are used to
restrict from something where Permission Set allows user to get extra permissions.
      Lets take Example--
      You have one profile assigned to 15 different users.
      Now Suppose you want give some extra permission to one of user. You
have two options here.
      a) To change Profile permissions : By this way those extra permissions will
received by every user who is having that profile
 
      b) Second way is to create a permission set having those extra permission. You
need to assign this permission set to particular user by navigating to User detail
page. In this way, you dont have to worry about other users, as only specific user is
getting those extra permissions.
 
      You can assign permission set as many users you want.
 
      8. If profile has read access and we create permission set with read/write
access then what will happen?
      Ans- Then profile will have both read and write access.
 
     9. If profile has read/write and permission set has read access then what
will happen?
     Ans- Then profile will have both read and write access. We cannot decrease
permission on profile but we can increase permissions using permission set.
 
     10. If account has related list Address and there is checkbox name
primary, then record insert in Address then each account has only one
address with checkbox true if records exist already in address with
checkbox true then make them false.
 
     11. What is future method?
     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/future-method-
and-prevent-mixed-dml.html
 
      12. Why we use future method and provide scenario where you have used
future method?
     Ans- Follow this link-- http://www.salesforceadda.com/2017/08/future-method-
and-prevent-mixed-dml.html
 
      13. How to read JSON in your class?
      
      14. Do you know about SOAP and Rest API?
 
     15. What is difference between role and profile?
      Ans- Role determines what is visible to the user
               Profile determines what actions they are allowed to perform
     16. Can we create user without profile?
     Ans- NO
 
     17. What is difference between insert and database.insert()?
     Ans- Follow this link: http://www.salesforceadda.com/2017/08/insert-vs-
databaseinsert-in-salesforce.html
 
     18. Why we use true and false in database.insert()? 
    Ans- Follow this link: http://www.salesforceadda.com/2017/08/insert-vs-
databaseinsert-in-salesforce.html
 
     19. If we have list of integer type and there is 20 items and want to
display list in table on page and I want to display 5 data then 5 and then 4
so on, how you will display?
 
     20. If we have 10 data and inserting 10 data and 3 insert successfully and
failed at 4 then what will happen when using Database.insert() .
     Ans- It will insert success records and not insert error records.
 
     21. Can we change picklist data type into text?
     Ans- Yes
 
     22. How to get list of child data in email templates.
     Ans- Cross Object Email Template is not Possible in salesforce at this point in time
Only Possible way to access and Display child record details in email template of
parent is to use Visualforce Email Templates.
 
     23. If there is one object and we create two lookup field related to User
object. And we have 3 users like A, B, C of same roles and same profile. If
we have assigned two users in two lookup like A and B then only these two
user can edit that object record C user cannot be able to edit the record.
How will you achieve this?
 
      24. What is having clause? Give the example.
      Ans- HAVING is a clause that can be used in a SOQL query to filter results that
aggregate functions return. You can use HAVING clause with GROUP By clause to
filter the results returned by aggregate function,such as SUM(). HAVING clause
similar to WHERE clause. The difference is that you can include in aggregate
functions in a HAVING Clause , but not in WHERE Clause.
      Ex- Firstly query,
      [Select Id, name from Lead] → It will return Lead record with Id and Name.
 
      [Select Id, Name from Lead GROUP BY name] then it will through error like  Field
must be grouped or aggregated: Id
 
[Select id, count(name) from Lead GROUP BY name ]-- then it will also through
error , you cannot use same field name used in count i.e-- select id, count(name)
from Lead GROUP BY name ^ ERROR at Row:1:Column:18 Grouped field should not
be aggregated: Name
 
[SELECT LeadSource, count(Name) FROM Lead GROUP BY LeadSource]-- Now it will
return record With LeadSource and count total name field correspond to particular
LeadSource.
 
[SELECT LeadSource, count(Name) FROM Lead GROUP BY LeadSource HAVING
count(Name)>6]-- It will filter above group by query and return records which
count is greate than 6.
 
25. What is return type of SOSL query?
 
Ans- List<List<SObject>>
 
26. What is return type of Aggregation query?
 
Ans- AggregateResult[]
 
27. What is soft delete and hard delete?
 
Ans- Using Hard Delete your data will not be stored in the recycle bin. It will be
permanently   deleted.
      But using Soft Delete you can restore those datas lated within 15days from recycle
bin.
 
     28. Difference between with sharing and without sharing?
      Ans- "with sharing" keyword in apex class so that it will enforce only sharing
rules of current user but not, object permissions, field level permissions
 
     But “without sharing” will not enforce only sharing rules of current user . does it
mean it will enforce current user object and field level permissions.
 
     29. Can we show error message using future method?
 

 Cognizant Interview Questions

 
                                                           Technical Round-1 and Round-2
 
    1.   Difference between all evaluations criteria in workflow rules?
    Ans- 

Evaluate the rule criteria each time a record is created. If the rule
criteria is met.
created In this option, the rule never runs more than once per record.

Evaluate the rule criteria each time a record is created or updated.


If the rule criteria is met, run the rule.
In this option, the rule repeatedly runs every time a record is
edited, as long as the record meets the rule criteria.
Note: We cannot add time-dependent actions to the rule if you
created, and every time it’s edited select this option.

Evaluate the rule criteria each time a record is created or updated.


 For a new record, run the rule if the rule criteria is met.
 For an updated record, run the rule only if the record is
changed from not meeting the rule criteria to meeting the
rule criteria.
created, and any time it’s edited With this option, the rule can run multiple times per record, but it
to subsequently meet criteria won’t run when the record edits are unrelated to the rule criteria.

2. We have two team service team and sales team, and we have 15 fields in Account object
and want to show 10 fields to service team and 5 fields to sales team, how will you do
this?
 
3. Define all sharing rules?
 
      4. What is Re-evaluate checkbox in workflow?
      5. What is trigger framework?
 
      6.  What is process builder? Can we use apex class in process builder?
 

      7.  Difference between process builder and workflow?


 
      8.  What is upsert? How it works?
 
      9. Can we call future method in batch class?
 

     Cognizant Interview Questions

 1.     What are Salesforce securities?


      
    2.  I want to delete child when I delete parent object records in lookup relationship, because we have
already too many master-detail in object and not able to create master-detail, so how will you
do this task?
 
      3. We have table with two rows with two columns, and data in table as-
 
     Columns:   Name       class
      Rows     :     Arun        10
                           Aman      12
 
      Write query to count of total number of 12th class student.
4. How to write rollup summary for lookup and how to update roll up summary using lookup.
 
5. Write down Roll Up summary trigger.
 
6. What are the mixed DML operations?
 
Ans:- Follow link-- http://www.salesforceadda.com/2017/08/future-method-and-prevent-mixed-dml.html
 
7. What are the best practices for test class?
 
8. What are the AJAX functions in salesforce?
 
9. Difference between render, rerender, render as.
 
10. What are the Sharing rules?
 
11. What is OWD? If for any object OWD is private so what will happen?
 
12. What is the default OWD of tasks and events?

Ans:- In Salesforce.com, for Activity objects (Task & Event), there are only 2 option in the Organization-
Wide Defaults sharing setting:
 Controlled by Parent
- Private
Private
Only activity owner (label as Assigned To), and users above the activity owner in the role hierarchy
can edit and delete the activity.
Users with read access to the record to which the activity is associated (Name and Related To) can view
and report on the activity.
Controlled by Parent
A user can perform an action (such as view, edit, transfer, and delete) on an activity based on whether
he or she can perform that same action on the records associated with the activity.

Example, if a task is associated with the Acme account and John Smith contact, then a user can only
edit that task if he or she can also edit the Acme account and the John Smith record.
13. Difference between save report and run report?
 
14. What are the buckets and formula fields in reports?
 
15. What is future method? What are the restriction of the future method? Can we call future
method from batch class?
 
16. Write query to get child from parent.
 
17. Assume there is user lookup in Account, if any user create account record then that user Id
should populate in lookup, how will you do this task?
 
18. Can we update record on account on ‘After insert’ trigger event?
 
19. What is forecasting in Salesforce?
 
20. What is territorial management?
 
21. What are the types of trigger and events?
 
Ans- 
         There are two types of triggers:
 
           Before triggers are used to update or validate record values before they’re saved to the database.
                  After triggers are used to access field values that are set by the system (such as a record's Id or
LastModifiedDate field)
Trigger Events:

Before Insert, Before Update, Before Delete, After Insert, After Update, After Delete and   after undelete
22. What is workflow and time dependent workflow? Write will send mail after 15 mins?
23. Create visual force page1 with  3 rows data like Here no data from database, just you create your
own field
A) Column:  Name   Checkbox
      Row 1:   Arun      True
      Row 2:   B            False
      Row 3:   C            True
Now we have showData button, then on click on button data which has checkbox
      True should display on another visual force page.
              

You might also like