Wednesday, 20 July 2016

Salesforce Interview Questions on Workflows and Approval Process




1. What is workflow ?
Ans: Workflow works based on certain criteria,By using workflow we can automate the business process like Email alerts,tasks,filed updates

2. What are the different kinds of evaluation criteria (events)?
Ans: 1.created
2.created, and every time it’s edited
3.created, and any time it’s edited to subsequently meet criteria

3. In which object workflows are stored?
Ans: Workflow

4. What is the difference between Created and everytime edited to meet the criteria and Created and edited to subsequently meet the criteria?
Ans: If we select 'Created and everytime edited to meet the criteria' whenever we create a record or edit a record if the criteria of the workflow rule meets then it will trigger every time. If we select 'Created and edited to subsequently meet the criteria' -

While creating the record criteria meets so that workflow will fire and while editing the record again criteria meets workflow won't fire (meeting the criteria to meeting the criteria)
While creating the record criteria doesn't meet so workflow won't fire and while editing the record workflow criteria meets then workflow will fire (not meeting the criteria to meeting the criteria)
Conclusion: Previous state of record should be not meeting criteria and current state of record should be meeting the criteria then only in current state workflow will fire.

5.What are the types of rule criteria’s?
Ans: 1.Criteria meet (field - operator - value, if there are multiple criteria’s then in filter criteria we can give conditions like ( 1 or 2) and 3, field to field comparison is not possible, we can't fetch the previous state information of the field )
2.Formula evaluated (we can write formulas with this we can do field to field comparison and we can fetch previous state value of the record)

6. What is immediate workflow action?
Ans: The action which will be performed immediately after the record criteria meets.

7. What is time-dependent workflow action?
Ans: The action which will be performed in future based on the any of the date field. To create time-dependent workflow action we should create one time trigger. in time trigger we can give either days or hours with the maximum of 999 value and we can select either before or after.

8. For which event we can't create time-dependent workflow action?
Ans: Created and every time edited to meet the criteria.

9. What are the different kinds of workflow actions?
Ans: New field update (we can update a field of the same object or the fields of the parent objects which are at the master side in a master-detail relationship, only for master-detail parent objects we can update the field and for lookup, we can't update)
New email alert (we can send emails if the criteria meets)
New task (we can create new task)
New outbound Message (we can make a callout)

10. What are the types of email templates?
Ans:1.Text
2.HTML (with letter head)
3.Custom HTML (without letter head)
4.Visual Force

12. How can you monitor future actions of time based workflow?
Ans: setup --> administration set up --> monitoring --> time based workflow

13. There is a time-based workflow which will update one of the fields if the criteria meet. User submits the record with valid criteria, workflow triggered so that the field update is queued in the 'time based flow' queue which will fire after one day. If the user modifies the record which is submitted before the scheduled date, after modification, a record criterion is not meeting. Whether the field will be updated or not on the scheduled date?
Ans: It won't trigger in the schedule date because if we modify the record to not meeting criteria that queued field update will be removed from the 'time based flow' queue.

14. For the same scenario explained in the above question what happens when we deactivate or modify the criteria of the workflow to different criteria? Whether the field will be updated or not in scheduled date?
Ans: Yes, It will trigger in scheduled date.

15. Scenario: There are two workflow rules on the same object say namely wf1 and wf2. If wf1 fires then a field will be updated on the same object, if the field updated and due to this wf2 criteria meets then what will happen, wf2 will fire or not?
Ans: It won't fire. To fire wf2 we should enable 'Re-evaluate Workflow Rules' checkbox of the field update which is there in wf1.

16. What is a recursive workflow rule? How to avoid recursive workflow rules?
Ans:Whenever we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule, due to this field update other workflow rules on the same object will be fired if the entery criteria of those workflow rules satisfied.

In case, in other workflow rules also if we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update recursive workflow rules will come in some scenarios.

We can take two steps to avoid recursive workflow rules -

For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive workflow rules.
If you don't enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule we can avoid.

17. What is Approval Process?
Ans: If the criteria of the record meets then by clicking on submit for Approval button user can submit the record for approval (Note: Approval history related list should be displayed on the record detail page)

18. Scenario: After activating the approval process, I want to add one more step. Is it possible?
Ans: It’s not possible, to add one more step deactivate the approval process and clone the deactivated approval process and add the new steps.

19.In which object all Approval process are stored?
Ans: Approval

20. For which criteria in workflow "time-dependent workflow action" cannot be created?
Ans: created, and every time it’s edited

Salesforce Interview questions on Sandbox environment



1.What is refreshing of the sandbox and how to do it?
In order to update the sandbox with the data in production.
Refresh is done and refreshing a sandbox deletes the previous copy and updates the sandbox with a copy of production.

To refresh a sandbox logon to salesforce.com
With production id and password
Go to setup>company name>administrative tools>data management >sandbox
Click the refresh link next to the sandbox

Note: make sure u have a copy of it before u refresh a sandbox

2.What is sandbox?
To make any changes for the exiting application we should copy all contents of the production into a sandbox and make all changes after that test thoroughly after that move those changes into production.
To create the sandbox, in production we can find one link called sandboxes. by clicking on that link we can create the sandbox by choosing the type of the sandbox.

3.What is the sandbox URL?
test.salesforce.com

4. What are the types of Sandboxes?

Salesforce Interview questions on Reports and Dashboard

1. What is Report?
To summarize the information of an object we use reports.

2. What are the types of Reports?
Tabular (Displays records just like a table)
Summary (we can summarize the information based on certain fields)
Matrix (we can summarize the information in a two-dimensional manner, both rows, and columns)
Join (we can summarize information in different blocks on the same object and the related objects)

3. How many blocks we can create for join reports?
5 blocks.

4. How many maximum groupings we can do for a summary, matrix, and join reports?
3 groupings

5. What is bucketing in reports?
Bucket field in Reports in Salesforce is used to group values to the name we specify.
It can group only the below data types fields
1. Picklist
2. Number
3. Text

6. How many records we can display on-page for a report?
We can display up to 2000 records on a page. If more records are there to display we cannot see those through the user interface. If you export the records to an excel sheet then you can export all records.

7. Can we mass delete reports using Apex (Anonymous Apex)?
Salesforce has not exposed any API for Reports. So the best way is :
Move all reports needs to delete in the new folder.
Inform everyone that reports will be deleted after some time maybe 30 days.
Import your reports folder in Eclipse including all reports to be deleted and then delete the reports folder in eclipse. It will delete all the reports at once.

8. Explain what a is dashboard?
The dashboard is the pictorial representation of the report, and we can add up to 20 reports in a single dashboard.

9. What are the different Dashboard Components?
Salesforce dashboard components are used to represent data. Salesforce dashboards have some visual representation components like graphs, charts, gauges, tables, metrics, and visualforce pages. We can use up to 20 components in a single dashboard.

10. Is it possible to schedule a dynamic dashboard in Salesforce?
No, it is not possible to schedule a dynamic dashboard in Salesforce.

11. Which type of report can be used for dashboard components?
Summary and matric report.

12. Explain the dynamic Dashboard?
Dynamic dashboards in Salesforce displays a set of metrics that we want across all levels of your organization.
Dynamic Dashboards in salesforce are Created to provide security settings for the dashboards in salesforce.com. We may have a requirement in an organization to “view all data” by every user in an organization according to their access we have to select Run as Logged-in User. There are two setting options in Dashboards.
They are
1.Run as specified User.
2.Run as Logged-in User.

Salesforce Interview Questions on Batch Apex

1. What are the SOQL limitations in apex?
Ans: Total number of records retrieved by SOQL queries-50,000

2. What are the transaction limitations in apex?
Ans: Each execution of a batch Apex job is considered a discrete transaction.
For example, a batch Apex job that contains 1,000 records and is executed without the optional scope parameter from Database.executeBatch is considered five transactions of 200 records each.
The Apex governor limits are reset for each transaction.
If the first transaction succeeds but the second fails, the database updates made in the first transaction are not rolled back.

3. What is the need of batch apex?
Ans: By using Batch apex classes we can process the records in batches in asynchronously.

4. What is Database.Batchable interface?
Ans: The class that implements this interface can be executed as a batch Apex job.

5. Define the methods in the batchable interface?
Ans:
Start:
global Database.Querylocator start (Database.BatchableContext bc){}
Execute:
global void execute(Database.BatchableContext bc,List <p>){}
Finish:
global void finish(Database.BatchableContext bc) {}

6. What is the purpose of the start method in batch apex?
Ans: It collects the records or objects to be passed to the interface method execute.

7. What is the Database.QueryLocator?
Ans: If we use a Database.QueryLocator,
the governor limit for the total number of records retrieved by SOQL queries is bypassed. (Default 50,000 It allow up to 50 million records).

8. What is the iterable<Sobject>?
Ans: If you use an iterable,
the governor limit for the total number of records retrieved by SOQL queries is still enforced.

9. What is the use of executing method?
Ans: Contains or calls the main execution logic for the batch job.

10. How many times execute method is called?
Ans: Execute method is called for each batch of records.

11. What is the scope of execute method?
Ans: The maximum value for the optional scope parameter is 2,000

12. Can we call callouts from batch apex?
Ans: Yes we can call.

13. Can we call another batch apex from batch apex?
Ans: Yes you can call a batch apex from another batch apex . Either in the start method or in the finish method you can call other batch

14. How many callouts we can call in batch apex?
Ans: Batch executions are limited to one callout per execution.

15. Batch is synchronous or asynchronous operations?
Ans: Asynchronous operations.

16. What is the maximum size of the batch and minimum size of the batch?
Ans: The default batch size is 200 records. min?
max?

17. What is the Database.BatchableContext?
Ans: BatchableContext Interface is Represents the parameter type of a batch job method and
contains the batch job ID. This interface is implemented internally by Apex.

18. How to track the details of the current running Batch using BatchableContext?
Ans: You can check the AsyncApexJob.Status using the JobId from the Database.BatchableContext.

19. How many batch jobs can be added to the queue?
Ans: Queued counts toward the limit of 5.

20. What is Database.State full interface?
Ans:To maintain variable value inside the Batch class, Database.Stateful is used.

21. What is Database.AllowCallouts?
Ans:
To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition. For example:
global class SearchAndReplace implements Database.Batchable<sObject>,
   Database.AllowsCallouts{
              //Business logic you want by implementing Batchable interface methods
}
Callouts include HTTP requests as well as methods defined with the webService keyword.

22. What is AsyncApexJob object?
Ans: AsyncApexJob is Represents an individual Apex sharing recalculation job.
Use this object to query Apex batch jobs in your organization.

23. When a BatchApexworker record is created?
Ans: For every 10,000 AsyncApexJob records, Apex creates one additional AsyncApexJob record of type BatchApexWorker for internal use. 

Salesforce Interview questions on Apex Triggers


1. What is a trigger?
Ans: Trigger is a piece of code that is executed before and after a record is Inserted/Updated/Deleted from the force.com database.

2. What are the different types of triggers in sfdc?
Ans: 1.Before Triggers-These triggers are fired before the data is saved into the database.
2.After Triggers-These triggers are fired after the data is saved into the database.

3. What are trigger context variables?
Ans:
Trigger.isInsert: Returns true if the trigger was fired due to insert operation.
Trigger.isUpdate: Returns true if the trigger was fired due to update operation.
Trigger.isDelete: Returns true if the trigger was fired due to deleting operation.
Trigger.isBefore: Returns true if the trigger was fired before the record is saved.
Trigger.isAfter: Returns true if the trigger was fired after the record is saved.
Trigger.New: Returns a list of a new version of sObject records.
Trigger.Old: Returns a list of old versions of sObject records.
Trigger.NewMap: Returns a map of new version of sObject records. (map is stored in the form of map)
Trigger.OldMap: Returns a map of old version of sObject records. (map is stored in the form of map)
Trigger.Size: Returns a integer (total number of records invoked due to trigger invocation for the both old and new)
Trigger.isExecuting: Returns true if the current apex code is a trigger.

4. What is the difference between Trigger.New and Trigger.NewMap?
Ans:
Trigger.New is Returns a list of new version of sObject records but Trigger.NewMap is Returns a map of new version of sObject records.

5. What is the difference between Trigger.New and Trigger.Old?
Ans:
Trigger.New is Returns a list of a new version of sObject records and Trigger.Old is Returns a list of old version of sObject records.

6. What is the difference between Trigger.New and Trigger.Old in update triggers?
Ans: Trigger.new: Returns a list of the new versions of the sObject records. Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.

 Trigger.old: Returns a list of the old versions of the sObject records. Note that this sObject list is only available in update and delete triggers.

trigger.old is not available during insert.

7. Can we call batch apex from the Trigger?
Ans: A batch apex can be called from a class as well as from trigger code.
In your Trigger code something like below:-
// BatchClass is the name of batch class
BatchClass bh = new BatchClass();
Database.executeBacth(bh);

8. What are the problems you have encountered when calling batch apex from the trigger?
Ans:  future method call that performs more processing on the same record(s). The issue is that this entire process becomes recursive in nature and you receive the error "System.AsyncException: Future method cannot be called from a future method.


9. Can we call the callouts from the trigger?
Ans: yes we can. It is the same as the usual class method calling from the trigger. The only difference being the method should always be asynchronous with @future

10. What are the problems you have encountered when calling apex the callouts in a trigger?
Ans: Too many Future calls".

11. What is the recursive trigger?
Ans: Recursion occurs in trigger if your trigger has the same DML statement and the same DML condition is used in trigger firing condition on the same object(on which trigger has been written)

12. What is the bulkifying triggers?
Ans: By default, every trigger is a bulk trigger which is used to process the multiple records at a time as a batch. For each batch of 200 records.

13. What is the use of future methods in triggers?
Ans: Using @Future annotation we can convert the Trigger into an Asynchronous Class and we can use a Callout method.

14. What is the order of executing the trigger apex?
Ans:
1. Executes all before triggers.
2. Validation rules.
3. Executes all after triggers.
4. Executes assignment rules.
5. Executes auto-response rules.
6. Executes workflow rules.
7. If there are workflow field updates, updates the record again.
8. If the record was updated with workflow field updates, fires before and after triggers one more time. Custom validation rules are not run again.
9. Executes escalation rules.
10. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through the save procedure.
11. If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. The grand-parent record goes through the save procedure.
12. Executes Criteria Based Sharing evaluation.
13. Commits all DML operations to the database.
14. Executes post-commit logic. Ex: Sending email.

15. How do we avoid recursive triggers?
Ans: Use a static variable in an Apex class to avoid an infinite loop. Static variables are local to the context of a Web request.

16. How many triggers we can define on an object?
Ans: We can write more than one trigger But it is not recommended. Best practice is One trigger On One object.

17. How many time workflow filed update will be called in triggers?
Ans: If the record was updated with workflow field updates, fires before and after triggers one more time (and only one more time).
Note The before and after triggers fire one more time only if something needs to be updated. If the fields have already been set to a value, the triggers are not fired again.

Salesforce Interview Questions on Profiles,Permission Set,Users,OWD,Roles and Sharing Rules



1.What is Profile?
ANS: Profile contains a set of permissions and access settings that control what users can do within the organization.

2. What are the permission sets?
ANS: A set of permissions is given to the users without changing the profile.

3.What is OWD?
ANS: OWD'S are baseline record-level security for objects in the organization.
It is used to restrict access to data.

4.What are Roles?
ANS: A role controls the level of visibility that users have to an organization's data.

5.What is the User?
ANS: The people who have an authenticated username and password to login to the salesforce successfully.

6.What is Sharing Rules?
ANS: These are used to override the OWD permissions.
Sharing rules are two types
1.Based on record owner
2.Based on criteria.

7.What is the role hierarchy?
ANS: Role Hierarchy states that a higher hierarchy person can see lower hierarchy person records.

8.Can you override profile permissions with permission sets(i have defined some permissions in the profile, I am trying to use permission sets for the same object, can I override permissions for a particular object in the permission sets over to the profile?
ANS: No. Permission Sets are used only to extend the Profile permissions. It never overrides.

9. I want to have read/write permission for User 1 and read-only for User 2, how can you achieve?
ANS: Create a Permission Set with read/write and assign it to User 1.

10. I have an OWD which is read-only, how all can access my data and I want to give read-write access for a particular record to them, how can I do that?
ANS: All users can just Read the record.
Create a Sharing Rule to give Read/Write access with "Based on the criteria" Sharing Rules.

11.What is the difference between role hierarchy and sharing rules? will both do the same permissions?
ANS: Role Hierarchy states that a higher hierarchy person can see lower hierarchy person records.
Sharing Rule is used to extending the Role Hierarchy.

12. Is it possible to delete the user in salesforce?
ANS: No, once we create a user in salesforce we cannot delete the user record. We can only deactivate the user record.

13.How to provide security for Meta-Data files (Schema)?
ANS: Using Profiles and Permission Sets.

13. How to give permissions to two fields for different users who belong to different profiles?
ANS: Permission set

14. How many users are there in your project salesforce instance?
ANS:1000 (It will depend upon the number of licenses taken by the client, it will be like up to 4000 like that based on the client)

15.What is Grant Access Using Hierarchies?
ANS: In OWD we have Private but your higher position persons should see that time we go for Grant Access Using Hierarchies.

16. How we can change the Grant access using role hierarchy for standard objects?
ANS: Not possible.

17.What is manual sharing?
ANS: Manual sharing is to share a record to a particular user manually.
Go to the detail page of the record and click on the manual sharing button and assign that record to other users with Read or Read/Write access.
Manual Sharing button enables only when OWD is private to that object.

18. The difference between Profile and Roles?
ANS: Profiles are used for Object-level access settings.
Roles are used for Record level access settings.

Wednesday, 13 July 2016

How to correctly reference Record Types in filter criteria when using the Lightning Process Builder



There are three ways to reference the Record Type in filter criteria when working in the Lightning Process Builder. Each reference field requires a different reference to the Record Type to evaluate correctly. 

1. Record Type ID: [Object].RecordTypeId 

This option must use the full 18 digit record type ID of the record type.

2. Record Type Name: [Object].RecordTypeName

This option needs to use the Display Name of the Record Type.

3. Record Type Developer Name: [Object].RecordType.DeveloperName

This option needs to use the API name of the record type found on the "Record Type Name" field on the record type details page.



Tools for Lightning Web Component Development

 Below are the tools required for Web Component Development 1. Chrome Browser (Prefered) You can download it from Google 2. Visual Studio Co...