Interview Questions: Part-1


Q:1 In which events, Trigger.oldMap and Trigger.NewMap is available?
 Answer : 


Q:2 What is a trigger?
Answer: A trigger is a class. Following are the few use cases of triggers
a. To perform complex business validations.
b. To modify the current transaction related data.etc.,

Refer here for detailed context variables list: Context Variables List

Q:3 I have 100 records in Account Object, I want to get 50th record to 75th record? How you will write a SOQL query?
Answer: 
Points to be considered :
a. The order is important means limit should come first and offset should come next.
b. The offset is a keyword which is used to skip no.of records to skip and limit is used to specify total no.of records to retrieve. 
c. This offset is helpful if we want to implement pagination(in visualforce pages)

Q:4 When to use these("=" , "=:" , "IN:" ,"IN", "Not IN") operators in SOQL query ?
Answer: 
a).If you want to get values based on exact value then use "=" operator.
Example:  
b). If you want to get values based on String value then use "=:" operator
Example : 
c)If you want to get the values by comparing a list or set then use "IN:" operator.
Example:
d). If you want to get the data based on a set of known matching values then use "IN". The values for IN must be in parentheses. String values must be surrounded by single quotes.
Example:
e). Using "NOT IN" in SOQL
Example : 

Q:5 What are the ways to write not equals operator in SOQL?
Answer: 
There are 2 ways :
Note :
======
There is no impact on performance, Salesforce is supporting these 2 approaches for not equals.
Few other SOQL queries here.

Q:6 How to display different fields from different objects using VF pages?
Answer: 
Visualforce page Name : DataFrommultipleObjects
Apex class Name : ApxCls
FOR TESTING THESE: CLICK HERE  [browser should have TLS1.1]

Q:7 I have one object 'A' with owd as public read-only and it's child 'B' is set to controlled by parent. I wanna set read for 'A' but for 'B' it shud be read and edit
Answer:
The only solution for this problem is you need to create a permission set with "Modify All" permission on Object "B" and assign this permission set to the users whoever need additional permissions.  

Q:8 Why Salesforce given an option to call an Approval process from Process builder?
Answer: 
1. Once the Approval process is created then on record detail page we can place "Submit for Approval" button. If user clicks on this record then only the Approval process will execute.

2. But what if the users forget to click the button? in this case the Approval process will not work. So, on record create/edit if we want to initiate the process builder without any button clicks then we will go for process builder.


tHiNk gooD and dO thE bEsT.........MANJU NATH 🌝

Comments