3 How can you edit apex classes in a production environment?
You cannot edit apex classes directly in a production environment. It needs to be first done in the sandbox, then deployed in production where a user with Author Apex permission can make the changes.
4 What are the different types of Apex triggers in Salesforce?
The two main types of Apex triggers are as follows:Â
Before triggers: For updating and validating record values before they are saved to the database.
trigger TriggerName on ObjectName(before event) //Here event can be insert, update or delete
After triggers: For accessing field values of the records set by the system and stored in the database. You can use these field values for making changes in other records.Â
trigger TriggerName on ObjectName(after event) //Here event can be insert, update or delete
3 What is a profile in Salesforce? Can two different users have the same profile?
A profile is a collection of permissions and settings that define all a user can do in Salesforce, giving them the authority to access certain records. There are various profiles, such as a sales profile, that can access contacts, leads, campaigns, and more.Â
People under a department can have the same profiles. For instance, several people are assigned the same sales profile in a sales department. So, any number of people can have the same profile.
2 What are the differences between trigger and workflow in Salesforce?
Workflow is an automated process that fires an action depending on evaluation criteria and rule criteria
A trigger is a piece of program code that will be executed before or after a record has been inserted or updated
We cannot carry out DML operations on workflow
We can use 20 DML operations in a single trigger
We are able to obtain a workflow across the object
We are able to access the trigger across the object and associated with that objects
We cannot query from database in workflow
We can use 20 SOQL(Salesforce Object Query Language) from the database in a single trigger
2 What causes data loss in Salesforce?
There are many things that cause data loss in Salesforce. They are:
When editing an object definition (incorrectly changing a picklist), importing data (overwriting good data with bad), or merging households are the common situations where human error may occur.
For example, when you import data, it becomes important to match up fields. Situations like moving to percent, number, and money from other data types or changing text area to URL, email, phone or text, etc. will lead to incorrect match in fields. If you are updating a large number of records and match up incorrect fields, your records will be invalid.
Accidental deletion of Salesforce data:
A record (or multiple records) might be accidentally deleted by users or employees. Deleting records could be because of miscommunication, forgetting to remove a contact from being deleted, and many other reasons. So proper training and having a trusted backup/recovery solution are much important.
Purposeful deletion of Salesforce data:
Disgruntled employees like the person who has recently got a very bad performance review and thinks their job is at stake or who is jealous of other employees might try to delete the data. A few clicks on the delete button may lead to the deletion of multiple records from Salesforce.
If they empty their recycle bin, that data recovery will be difficult using the Weekly Export. It can cause numerous damages if these records are not backed up properly.
Data sync errors:
If you have more than one admin or use Outlook for Salesforce, you might experience a data sync error at some point.
For example, one admin is trying to refresh a sandbox while another admin is working from home and trying to edit an object type in that same sandbox. When this happens, the admin who was editing the object can lose his work in progress.
Contacts in Outlook can over-write good Salesforce data when using Outlook for Salesforce, introducing errors through inappropriate sync.