Play Games

Search This Blog

Saturday, January 9, 2016

Scenario Based Interview Questions in Salesforce

Scenario Based Interview Questions in Salesforce

1) You have a page with Standard Controller and one Extension class.In Extenstion class you have a method name called save().Now when your invoking save() method from page whether it will execute Standard Controller save() method or Extension class save() method?
Ans : The Save() method from the Extenstion class will be executed.
2) In a trigger you have addError() method and below that statement you have a System.debug() statement.If addError() method is executed in trigger in that case whether System.debug() statement will be executed or not?
Ans : Yes,Even after addError() method got executed the execution will not be stopped at that line and it will executes below the System.debug() statement also.
3) If in your organisation Person Account feature is enabled.Whenever your converting the Lead how you will decide which Account(Business or Person) to be created?
Ans : Based on the company field value on Lead we will decide whether to create Business Account or Person Account.If Company field value in Lead object is blank then we will create Person account on it's conversion and If Company Field value on Lead object is not blank we will create Business Account
4) How will say particular lead is a Business Lead or Person Lead?
Ans : Based on the company field value on Lead we will decide whether that Lead is Business Lead or Person Lead.If Company Field value is blank then it will be treated as Person Lead,If not it will be treated as Business Lead
5) Lets assume your having a object called Quotes and it is having 4 fields.Now I want to add one extra field to each and every record in Quote object without creating it in Object and I want to display list of Quote records on visual force page with 5 fields not with only 4 fields.
Ans : Whenever your working with these type of scenarios (i.e., Add extra field to each and every record in object actually not creating that field in object) we have to use Wrapper class concept which will add one or more fields for each and every record.
6) When you will end up with MIXED_DML_OPERATION error in Salesforce?
Ans: With in a single transaction if you are trying to perform dml operations on setup objects and non-setup objects with same user(Logged in user) than it throws that error.To avoid that error we need to perform DML on Set up objects with logged in user and on non setup objects with some other user using System.runAs() and vice versa
7) While setting OWD (Organization wide sharing), can we change/modify the setting of child record in case of Master-Detail relationship?
Ans: No, child record is controlled by parent settings.

8) In case of Master-Detail relationship, on Update of child record can we update the field of Parent record using workflow rule?
Ans: Yes, the Master fields are also available for evaluation criteria.So, we can acheive this with workflow.For more information please visit this post

9) How to know the type of a field of an object in apex code?(For example how to get type of AccountSource field of Account object).
Ans: Map<String, Schema.SObjectField> accountFieldMap;
accountFieldMap = Schema.SObjectType.Account.fields.getMap();
Schema.SObjectField field = accountFieldMap.get('AccountSource');
Schema.DisplayType fieldType= field.getDescribe().getType();
system.debug('Type of AccountSource Field :'+fieldType);

No comments:

Post a Comment