Salesforce Scenario Based Interview Questions and Answers | Part 3
Summary
TLDRThis video explores advanced Salesforce interview questions, focusing on Apex, asynchronous Apex, and Lightning Web Components (LWC). It delves into Salesforce's request pipeline, discussing the execution order of automation tools and the impact of validation and workflow rules. The presenter also addresses the use of platform events for handling asynchronous operations in LWC, the application of user permissions in Apex, and the intricacies of DML operations across multiple objects. Additionally, the video covers the differences between 'with sharing' and programmatic sharing in Apex, the behavior of queueable jobs, and lead conversion ownership. The script aims to prepare viewers for technical Salesforce interviews by covering these complex topics.
Takeaways
- 😀 Salesforce interviews often ask scenario-based questions involving Apex, asynchronous Apex, admin, Integrations in LWC, and other Salesforce tools.
- 🎥 The speaker has created a series of videos covering LWC from basic to advanced topics, with links provided in the description for further learning.
- 🔄 The order of execution for Salesforce automation tools is governed by the 'wave of execution', where validation rules execute before workflow rules.
- 🚫 A validation rule conflict scenario reveals that a record might not be saved due to validation rule conditions, highlighting the importance of rule design.
- 🔄 Custom validation rules do not rerun if a field update is made by a workflow rule, which is considered a loophole in the Salesforce execution pipeline.
- 📡 Future methods in Apex, being asynchronous, cannot directly show callout responses in LWC components, but can be achieved using platform events and the Lightning Message Service.
- 🔑 Understanding Salesforce security and sharing models is crucial, as demonstrated by the scenario involving object permissions and DML operations in triggers.
- 🔄 Apex code typically runs in 'system mode', bypassing user permissions, but Salesforce provides ways to enforce 'user mode' for respecting permissions during DML operations.
- 🔍 The difference between 'with sharing' and Apex 'manage sharing' settings is explained, with the former enforcing sharing rules and the latter allowing programmatic sharing of records.
- ❌ If a transaction rolls back after submitting a queueable job, the job will not be processed, emphasizing the relationship between transactions and asynchronous jobs.
- 🔄 Lead conversion in Salesforce changes the ownership of the Opportunity, Account, and Contact records to the user who performs the conversion, not the original lead owner.
Q & A
What is the order of execution for automation tools in Salesforce?
-In Salesforce, the order of execution is predefined and known as the governor execution order. Validation rules execute prior to workflow rules, and custom validation rules do not run again if field updates are made by workflow rules.
Why are custom validation rules not re-executed after a workflow rule modifies a field?
-Custom validation rules are not re-executed after a workflow rule modifies a field because Salesforce's governor execution order dictates that only triggers and standard validation rules run again if a field update is made by a workflow rule.
Can we show the response of a future method callout on a Lightning Web Component (LWC)?
-Directly showing the response of a future method callout on an LWC is not possible because future methods are asynchronous and execute in a separate thread. However, using platform events to publish and subscribe to the callout response can achieve this.
How can we handle permissions when inserting a record from a trigger in Salesforce?
-Salesforce triggers run in system mode by default, which means they bypass user permissions. To enforce user permissions, you can use Apex code with user mode settings, such as `Database.enforceUserMode` or by using schema methods or user mode database operations.
What is the difference between 'with sharing' and Apex 'manage sharing' settings?
-'With sharing' is a keyword used in Apex classes to enforce sharing rules for specific classes, ensuring that queries respect the user's permissions. 'Manage sharing' in Apex allows for programmatic sharing of records, where you can insert sharing records to grant access to specific users.
What happens to a queued job if the submitting transaction is rolled back?
-If the submitting transaction is rolled back, the queued job will not be processed, as Salesforce does not execute asynchronous jobs in such cases.
Who becomes the owner of the opportunity, account, and contact after a lead conversion?
-After a lead conversion, the user who is converting the lead becomes the owner of the opportunity, account, and contact, regardless of the original lead owner.
Can we perform DML on multiple objects in a single DML operation in Salesforce?
-Yes, you can perform DML on multiple objects in a single DML operation by using a generic sObject list and adding different object records to it. This is possible as long as there is no parent-child relationship between the objects.
How can we save related objects in a single transaction in Salesforce?
-You can save related objects in a single transaction by using an external ID as a foreign key to create parent and child records in a single DML operation.
Can we set the calling order of wire methods in LWC?
-Directly setting the calling order of wire methods in LWC is not possible, as they are called automatically by the framework. However, dependencies can be managed by passing reactive parameters to dependent wire methods, causing them to re-call when the parameter value changes.
Outlines
Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.
Mejorar ahoraMindmap
Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.
Mejorar ahoraKeywords
Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.
Mejorar ahoraHighlights
Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.
Mejorar ahoraTranscripts
Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.
Mejorar ahoraVer Más Videos Relacionados
Salesforce Apex Interview Questions & Answers #salesforce #apex #interview
Display Images in Oracle APEX Interactive Reports and Forms - Part 8
Exploring Interactive Grid in Oracle APEX - Part 6
C# Async/Await/Task Explained (Deep Dive)
Javascript Promises vs Async Await EXPLAINED (in 5 minutes)
Payout Status Updates
5.0 / 5 (0 votes)