Sowjanya Interview Questions
Sowjanya Interview Questions
2.Can you please evaluate your Current Project and Your Role in Current Project.
Role Profile
The sharing rules are applied when a user wishes to allow access to other users.
8. What is the Trigger Best practices.
One Trigger Per Object
Use Context-Specific Handler Methods
Bulkily Your Code
Avoid SOQL or DML Inside Loops
Use Collections Effectively
Minimize Trigger Logic
Use Trigger Frameworks
Handle Recursion Carefully
Avoid Hardcoding IDs and Values
Handle Bulk DML Operations Efficiently
Use Trigger.new and Trigger.old Appropriately
Test Your Triggers Properly
Consider Governor Limits
Use Exception Handling Wisely
9. What Are Different Kinds of Reports?
Tabular Reports
Summary Reports
Matrix Reports
Joined Reports
10.How can you show a custom error message in trigger?
"In Salesforce, we can show custom error messages within a trigger by using the
addError() method. This method is typically applied when we want to enforce specific
business logic or validation that cannot be handled through declarative tools like
validation rules.
11. Why do we need to write test classes?
Ensure Code Quality: They verify that the code behaves as expected and
handles edge cases.
Prevent Future Bugs: Tests catch issues when modifying existing functionality.
Deployment Requirement: Salesforce requires 75% code coverage to deploy to
production.
Governor Limit Compliance: Test classes ensure the code works within
Salesforce’s limits, especially with bulk data.
Support Refactoring: They make it safer to update or refactor code without
breaking existing functionality.
12.What is minimum coverage for every Apex class and trigger for deployment?
Apex class is 75%
All triggers must have at least some coverage (i.e., not 0%).
13. How to call the Apex class method in JavaScript file?
import myMethod from '@salesforce/apex/MyApexClass.myMethod';
14. What are different ways of deployment in salesforce?
finish:
Purpose: This method is called after all batches have been processed. It can be used to
perform any final operations, such as sending notifications or logging results.
18. Can you edit an apex trigger/ apex class in production environment?
No we can not edit
19.Write a trigger for Last modified 10 accounts related contacts update last name
to “Dummy”.
Public class UpdateContacts
Public Static void updateLastNameToDummy(){
List<Accounts>LastModifiedAccounts=[Select Id , Name FROM Account ORDER BY
lastmodifieddate DESC Limit 10];
List<Contact> relatedContacts=[ SELECT Id,LastName FROM Contact Where AccountId IN
: LastModifiedAccounts ];
For(Contact Contact : relatedContacts){
Contact. LastName=’Dummy’;
}
Update relatedContacts;
}
}