Posts

All About Future methods

What are future methods ? Ans :  1. Methods used when you want to run apex transaction asynchronously 2. Static methods with @future annotation and void return type 3. Accepts only primitive types as arguments 4. Only 50 future calls are allowed per apex invocation 5. You can not call one future method from another future method When we generally use future methods? Ans: 1. When you want to make callouts to external web service in trigger 2. When you want to make callout after DML operation 3. When process needs to run in their own thread for processing records or complex calculaions 4. Isolating DML operations on different SObjects types to prevent mixed DML error . When we try to insert set up and Non set up object at a time we come across mixed DML exception. Why we can not pass Sobjects to future methods? Ans: The reason why objects can’t be passed as arguments to future methods is because the object can change between the time you call the method and the time that it actually exec

Salesforce Journey

 I   started my career as dot net developer with Datamatics Global Services Ltd in  March 2011 . Then I got chance to work with Orion India System Pvt Ltd from Aug 2013 till date. Upto Dec 2016 I was working on dot net technologies in Orion India Sys Pvt Ltd. Later I was introduced to Salesforce Technologies ,specifically in Service Cloud. After working on Service Cloud for one year I was shifted to Sales Cloud project.  In  Dec 2021 I was going on Maternity Leave. So I was told to work on dot net project POC for few days which was about 3 months. I was promised to return to Salesforce project after returning from Maternity leave which did not happen and I was assigned to same dot net project 😟. After working for a month I decided to resign and started giving interviews  as Salesforce Developer. It was very difficult for me to return as Salesforce Developer as I was having almost more than year of gap because of  dot net project and my maternity leave which I enjoyed irrespective of e

Salesforce interview questions and answers : All about SOQL : Part 1

Que 1. What is replacement of SELECT *  in SOQL? Ans 1. SELECT FIELDS(ALL) FROM Account.               SELECT FIELDS(STANDARD) FROM Account             SELECT FIELDS(CUSTOM) FROM Account * Can not add duplicates fields in select statement Que 2. Which standard objects acts as Junction object ? Ans 2.  1. OpportunityLineItem 2.  OpportunityContactRole 3. CaseSolution 4. CaseArticle 5 PriceBookEntry Que 3. What is FOR UPDATE in SOQL? Ans 3. FOR UPDATE is used for - prevent race conditions                                                                 - thread safety problems       e.g. Account[] accts=[Select Id from Account limit 2 FOR UPDATE]; To lock records,records can't be modified by other user either through code or UI. Que 4. What are types of SOQL queries? Ans 4.  1. Parent to Child (Inner query) When we want to get related child records from for a particular parent records or set of parent record then we use concept of inner query. e.g. SELECT Id,Name,(SELECT Id,Name from

Salesforce interview questions and answers : All About Triggers : Part 1

Que 1. What are types of triggers? Ans 1.  1.Before  2.After Que 2. What are events in triggers ?  Ans 2. Following are events in writing triggers : 1. Before insert 2. After insert 3. Before update 4. After update 5. Before delete 6. After delete 7.After undelete Que 3. What are context variables in triggers? Ans 3. Following are context variables in triggers : 1.Trigger.isExecuting 2. Trigger.size() 3.Trigger.isBefore 4.Trigger.isInsert 5.Trigger.isAfter 6.Trigger.isUpdate 7.Trigger.isDelete 8.Trigger.isUndelete 9.Trigger.new 10. Trigger.newMap 11.Trigger.old 12.Trigger.oldMap Que 4. Consider scenario  I have two objects Parent__c and Child__c with parent-child relationship. OWD settings for Parent__c is Public Read/Write and for Child__c it is Private. The User1 has Read/Write/Delete/Edit access on Parent__c and No Access on Child__c object. I wrote a simple trigger on Parent__c on update to create a child record Child__c. When I update the Parent record from User1, a new child reco