Professional Documents
Culture Documents
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?
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:
7)With the before Insert event which context variable is correct Trigger.new or
Trigger.newmap?
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 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.
//A runtime exception is thrown if the below query returns enough records to exceed your
heap limit.
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?
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).
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?
1)App Page
2)Home Page
3)Record Page
1) Standard Components:
2) Custom Components:
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.
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.
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?
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?
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?
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:
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?
<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?
<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?
39) How to ensure field level security while working with lightning components?
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?
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?
Sample syntax:
defaultFieldValues attribute inside setParams let us auto populate value on fields inside
record form.
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();
}
})
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}"
/>
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.