Question 1: write a trigger whenever the account owner changes its related contact owner should be changed.
trigger UpdateContactOwnerOnAccountOwnerChange on Account (after update) {
// Create a list to hold the updated Accounts
List<Account> updatedAccounts = new List<Account>();
// Iterate through the Trigger.new list to find updated Accounts
for (Account updatedAccount : Trigger.new) {
// Check if the owner of the Account has been changed
if (Trigger.oldMap.get(updatedAccount.Id).OwnerId != updatedAccount.OwnerId) {
// Add the updated Account to the list for later processing
updatedAccounts.add(updatedAccount);
}
}
// Call the handler class method to update related Contacts
if (!updatedAccounts.isEmpty()) {
ContactOwnerUpdater.updateContactOwners(updatedAccounts);
}
}
public class ContactOwnerUpdater {
public static void updateContactOwners(List<Account> updatedAccounts) {
// Create a list to hold the related Contacts to update
List<Contact> contactsToUpdate = new List<Contact>();
// Create a set to hold the Account Ids whose owners have changed
Set<Id> accountIdsToUpdate = new Set<Id>();
// Iterate through the updated Accounts
for (Account acc : updatedAccounts) {
accountIdsToUpdate.add(acc.Id);
}
// Query for Contacts related to the updated Accounts
List<Contact> relatedContacts = [SELECT Id, OwnerId FROM Contact WHERE AccountId IN :accountIdsToUpdate];
// Iterate through the related Contacts and update their owners
for (Contact con : relatedContacts) {
// Update the Contact owner to match the new Account owner
con.OwnerId = Trigger.newMap.get(con.AccountId).OwnerId;
contactsToUpdate.add(con);
}
// Perform the bulk update of Contact records
if (!contactsToUpdate.isEmpty()) {
update contactsToUpdate;
}
}
}
Question 2: What is the Difference between Profiles and Roles?
Profiles | Roles |
---|---|
Determine what users can do within the application. | Define the hierarchical structure of the organization. |
Control access to objects, fields, and features in Salesforce. | Define data visibility and access levels based on the role hierarchy. |
Associated directly with individual users. | Applied to groups of users based on their position or role within the organization. |
Typically managed by Salesforce administrators. | Managed by Salesforce administrators and may require periodic updates as organizational roles change. |
Provide granular control over user access and functionality. | Impact data visibility and access across the organization. |
Sales User, Marketing Manager, System Administrator. | Sales Representative, Sales Manager, Executive. |
Question 3: How Many Types of Relationship in Salesforce?
Answer 3: There are three main types of relationships in Salesforce:
- Lookup Relationship
- Master-Detail Relationship
- Many-to-Many Relationship (through Junction Objects)
Question 4: How Many types of Flows are in Salesforce?
Answer 4: There are 6 types of flows in Salesforce:
- Autolaunched Flows
- Screen Flows
- Record Triggered Flows
- Scheduled Flows
- Platform Event Triggered Flows
- Record triggered Orchestration Flow
Question 5: What is the difference between Record Triggerd Flows and Triggers?
Record-Triggered Flows | Triggers |
---|---|
Declarative automation tool in Salesforce. | Programmatic automation tool. |
Flow Builder provides a visual interface for configuration. | Written in Apex code. |
Executes in the Salesforce cloud. | Executes in the Salesforce cloud or on-premises servers. |
Can be more granular and targeted to specific objects and fields. | Can be written to handle complex logic and multiple objects. |
Generally easier to maintain and update. | Requires developer expertise for maintenance and updates. |
Offers built-in error handling and fault tolerance. | Error handling needs to be explicitly programmed. |
Provides debugging tools within Flow Builder. | Requires debugging using Apex logs and debug statements. |
May consume more system resources due to platform processing. | Can be optimized for resource usage by experienced developers. |
Suitable for simpler automation scenarios. | Can handle complex logic and intricate business processes. |
Question 6: What is the Difference Between Workflows and Process Builder?
Workflows | Process Builder |
---|---|
Basic automation tool in Salesforce. | More advanced automation tool. |
Uses a simple interface with limited options. | Provides a more intuitive and user-friendly interface with more capabilities. |
Limited to basic actions like field updates, email alerts, and outbound messages. | Supports a wide range of actions including creating, updating, deleting records, launching flows, and posting to Chatter. |
Supports simple criteria based on record changes. | Supports complex criteria with multiple conditions and related object fields. |
Can trigger time-dependent actions. | Can’t trigger time-dependent actions directly, but can initiate scheduled actions through flows or Apex. |
Cannot perform cross-object field updates. | Supports cross-object field updates without writing code. |
Limited debugging options. | Provides more robust debugging and testing capabilities. |
Less flexible in handling complex scenarios. | More flexible in handling complex automation requirements. |
Question 7: How to Invoke Flows or Process Builder in Apex?
Answer 7: Flows and Process Builder can be invoked in Apex using the
System.Flow.Interview
class.
Question 8: Explain the Whole Process of Sales Cloud.
Answer 8: Sales Cloud is Salesforce’s CRM platform focused on managing sales processes, leads, opportunities, and customer interactions. The process typically involves lead generation, lead qualification, opportunity management, forecasting, and closing deals.
Question 9: Explain the whole process of the Non-Profit Cloud.
Answer 9: Non-Profit Cloud is Salesforce’s solution tailored for non-profit organizations to manage donors, volunteers, programs, and fundraising efforts. The process involves donor management, fundraising campaigns, volunteer engagement, and program tracking.
Question 10: What are the different Security Models available in Salesforce?
Answer 10: There are main security models in Salesforce:
- Organization-Wide Defaults
- Role Hierarchy
- Sharing Rules
- Profiles
- Permission Set
Question 11: What is the use of External IDs in Salesforce?
Answer 11: External IDs are custom fields that uniquely identify records in Salesforce and can be used for data integration, data import, and upsert operations.
Question 12: What are the different types of trigger events?
Answer 12: There are two types of trigger events in Salesforce:
- Before Triggers
- After Triggers
Question 13: What is the difference between freezing a user or Deactivating a user?
Freezing a User | Deactivating a User |
---|---|
Temporarily suspends access to Salesforce. | Permanently disables access to Salesforce. |
Login credentials remain intact but are disabled. | Login credentials are removed. |
Permanent action; the user cannot regain access without reactivation. | Permanent action; user cannot regain access without reactivation. |
Record ownership and visibility remain unchanged. | Record ownership and visibility remain unchanged. |
Data associated with the user remains unaffected. | Data associated with the user remains intact. |
Temporary action; the user can be unfrozen to regain access. | Used when a user no longer needs access to Salesforce, such as when leaving the company. |
Question 14: What are the auto-response rules in Salesforce?
Answer 14: Auto-response rules in Salesforce are a way to automatically send email responses to leads or cases based on predefined criteria. These rules are typically used to acknowledge customer inquiries or to provide immediate responses.
Question 15: What is the roll-up summary field in Salesforce?
Answer 15: A roll-up summary field in Salesforce is a custom field on a master record that aggregates values from related detail records. It allows you to perform calculations on child records and display the result on the parent record.
Question 16: What is the difference between custom metadata type and custom settings?
Custom Metadata Type | Custom Settings |
---|---|
Metadata, stored in metadata API | Data, stored in the application cache |
Org-wide or Public Read/Write | Org-wide, Public Read/Write, or Protected |
Deployed via Metadata API | Included in change sets or packages |
Configuration settings, flexible schema | Configuration or application settings |
Viewed as metadata, customizable visibility | Viewed as data, based on access settings |
Question 17: What are auth providers, external services, & named credentials?
Auth Providers | External Services | Named Credentials |
---|---|---|
Authenticate users and grant access | Connect to external web services | Store and manage authentication credentials |
Setup in Salesforce under Auth. Providers | Setup in Salesforce under External Services | Setup in Salesforce under Named Credentials |
Single Sign-On, external system integration | Call and interact with external REST services | Provide secure authentication for integrations |
OAuth, SAML, OpenID Connect | OAuth, API Key, Username-Password | Username-Password, OAuth, API Key |
Question 18: What is the external data source?
Answer 18: An external data source in Salesforce is a way to integrate and access data stored outside of Salesforce, typically in an external system or database.
Question 19: what is the junction object?
Answer 19: A junction object in Salesforce is a custom object with two master-detail relationships, often used to model a many-to-many relationship between two objects. It serves as a linking or bridging table between the two objects. For example, if you have objects for “Students” and “Classes,” a junction object named “Enrollment” could connect students to classes.
Question 20: What is the difference between profiles & Permission Sets?
Profiles | Permission Sets |
---|---|
Assigned to users, controls overall access | Assigned to users, provides additional access |
Hierarchical, inherited by all lower roles | Not hierarchical, assigned individually |
Controls CRUD, FLS, and object permissions | Grants additional permissions beyond profiles |
Limited flexibility, one profile per user | More flexible, multiple permission sets per user |
Included in profiles, part of metadata | Included in change sets or packages |