Salesforce Developer Interview Questions on Future Methods
In this video, we discuss the Interview questions on future methods asked generally during Salesforce Developer Interviews.
Following is the list of questions discussed in the video:
Q 1. What is the use of the Future Method?
Q 2. What is the return type and modifiers of the Future Method?
Q3. Why future method is static?
Q 4. What are the parameters you can pass to the Future Method?
Q 5. Can we not pass Sobjects as parameters to the Future Method?
Q6 Why cannot we pass sobjects to future methods ?
Q7. How to work with Sobjects in future methods then if we cannot pass them as arguments?
Q8 What if I want to pass the current state of object instead of SObject Id to future method. Any trick you can think of?
Q9 How can we call future methods?
Q10 How can we call a future method from process builder?
Q11. Consider a scenario where you are making a DML let’s say update account record and right after that DML you are making a callout to external system. What will happen ?
Q12. How do you resolve this error?
Q13.How can I perform Callouts from Future methods?
Q14 What is a Mixed DML error?
Q15 How to resolve this error?
Q16. How Many Future methods can be defined in a Class?
Q17. Can we call a future method from another future method?
Q18. Can we trace the execution of future method?
Q19 How can we debug the future method?
Q20. Can we decide the order in which future method executes?
Q21. How to test future methods?
Q22. Can we pass wrapper to the future method?
Q23. Can we call a future method from apex schedular?
Q24 What are the best practices for future methods?
Q25 So, consider a scenario where I am calling a future method from Account’s trigger, and there is a batch job running on Account records which performs DML on them. Will the future method be invoked?
Q26. What can be workaround in previous question. How can we avoid exceptions?
Q27. Is there any way we can call future method from batch class’s execute method or from another future method?
Q27. Is there any way we can call future method from batch class’s execute method or from another future method?