Salesforce Interview Questions with Answers Part 65

Salesforce Interview Questions with Answers Part 65

1. Fault Connector in Salesforce Flow
While a connector element determines the normal path of flow execution, a fault connector is executed at runtime only when its source element results in an error.
This can be used for Exception Handling in Flows.
User-friendly messages can be shown to avoid confusion to the user when there is an exception in Flow execution.
It can be used to handle errors/exceptions.
2. Getter and Setter
A getter executes logic when a property is read. A setter executes logic when a property is written to.
3. What is the output of (“10” / 2) * “5” – “2” + “5” in JavaScript?
Answer is 235
(“10” / 2) = 5
“5” * “5” = 25
25 – “2” = 23
23 + “5” = 235 (string concatenation)

Reason:
All arithmetic operators except ‘+’ auto-casts operands to Number type. While ‘+’ defaults to string concatenation if one of the operands is a string.

4. Permission to create Campaign in Salesforce
Marketing User check box on the user detail is required to create Campaigns.
Marketing Users can view, create, edit, and delete Campaigns as long as they have the “Read,” “Create,” “Edit,” and “Delete” permissions for Campaigns in the Profile.
Users that don’t have the Marketing User checkbox selected only have access to view Campaigns and advanced Campaign setup, edit the Campaign History for a single lead or contact, and run Campaign reports if they have the “Read” permission for Campaigns.
5. lightningStylesheets, apex:slds and apex:includeLightning
lightningStylesheets=”true” – Make Visualforce apps look better in Lightning.
<apex:slds/> – To use markup specified by SLDS in Visualforce page.
<apex:includeLightning/>
There are three steps to add Aura components to a Visualforce page.
Add the Lightning Components for Visualforce JavaScript library to your Visualforce page using the <apex:includeLightning/> component.
Create and reference a Lightning app that declares your component dependencies.
Write a JavaScript function that creates the component on the page using $Lightning.createComponent().
6. renderUsingSystemContextWithoutSharing=”True”
When renderUsingSystemContextWithoutSharing=”True”, the email template runs in system mode, which bypasses user permissions, field-level security, and organization-wide defaults. Be careful when using this setting so that you don’t inadvertently expose sensitive data. Before using this setting, assess the impact of the guest security policy and, if necessary, update the Visualforce email templates instead.

In Summer ‘20, Salesforce introduced a security policy that affects Visualforce email templates used to send emails to guest users in communities.

7. Process Builder Best Practice in Salesforce 
For each object, use one automation tool. If an object has one process, one Apex trigger, and three workflow rules, you can’t reliably predict the results of a record change.
8. Events communication in Salesforce LWC
Lightning web components dispatch standard DOM events. Components can also create and dispatch custom events. Use events to communicate up the component containment hierarchy. For example, a child component, c-todo-item, dispatches an event to tell its parent, c-todo-app, that a user selected it.
Create and Dispatch Events
Create and dispatch events in a component’s JavaScript class. To create an event, use the CustomEvent() constructor. To dispatch an event, call the EventTarget.dispatchEvent() method.
The CustomEvent() constructor has one required parameter, which is a string indicating the event type. As a component author, you name the event type when you create the event. You can use any string as your event type. However, we recommend that you conform with the DOM event standard.
No uppercase letters
No spaces
Use underscores to separate words
Don’t prefix your event name with the string on, because inline event handler names must start with the string on. If your event is called onmessage, the markup would be <c-my-component ononmessage={handleMessage}>. Notice the doubled word onon, which is confusing.
9. Private Connect in Salesforce
When you want to integrate third-party services with Salesforce, it’s essential to be able to communicate securely. With Private Connect, you can increase security on your HTTP/s traffic by setting up a fully managed secure connection between Salesforce data centers and Amazon Web Services (AWS). API calls that run through AWS PrivateLink don’t traverse the internet, reducing exposure to outsider security threats.

In AWS, Salesforce VPC will do the callouts so that it won’t go to the outside internet.

10. Send Email to Members in Salesforce Queue

An Email is sent to all Queue members individually when new records are placed in the Queue if:

1. The Queue Email field is left Blank regardless if the ‘Send Email to Members’ checkbox is selected or notOR

2. When there is a Queue Email specified AND the ‘Send Email to Members’ checkbox is selected.

The Send Email to queue members alert will only work if you are using Case Assignment Rules and Active Assignment checkbox to move Case to a Queue. If you are moving the case Manually to a Queue or using a Workflow, it does not trigger the Email alert. The Email is also triggered when a Lead is created from a Web-to-Lead form.

Referece Link – https://help.salesforce.com/articleView?id=000323036&type=1&mode=1

11. Calling Apex from LWC
To call an Apex method, a Lightning web component can:

1. Wire a property
2. Wire a function
3. Call a method imperatively

Whether you use @wire or call a method imperatively, the data is stored in the Lightning Data Service cache. However, data provisioned by Apex is not managed by Lightning Data Service. If you use @wire to call an Apex method, refresh data using refreshApex() when data gets stale. If you call an Apex method imperatively, refresh data by invoking the Apex method again.

When you call a method imperatively, you receive only a single response. Compare this behavior with @wire, which delegates control to the framework and results in a stream of values being provisioned.

Imperative Call:
import { LightningElement, track } from ‘lwc’;
import getContactList from ‘@salesforce/apex/ContactController.getContactList’;

export default class ApexImperativeMethod extends LightningElement {
    @track contacts;
    @track error;

    handleLoad() {
        getContactList()
            .then(result => {
                this.contacts = result;
            })
            .catch(error => {
                this.error = error;
            });
    }
}

@wire a property:
import apexMethodName from ‘@salesforce/apex/Namespace.Classname.apexMethodReference’;
@wire(apexMethodName, { apexMethodParams })
propertyOrFunction;

@wire a function:
import { LightningElement, wire } from ‘lwc’;
import getContactList from ‘@salesforce/apex/ContactController.getContactList’;

export default class ApexWireMethodToFunction extends LightningElement {
    contacts;
    error;

    @wire(getContactList)
    wiredContacts({ error, data }) {
        if (data) {
            this.contacts = data;
            this.error = undefined;
        } else if (error) {
            this.error = error;
            this.contacts = undefined;
        }
    }
}

12. Order of events when a merge occurs in Salesforce
If two contacts are merged, only the delete and update contact triggers fire. No triggers for records related to the contacts, such as accounts or opportunities, fire.

1. The before delete trigger fires.
2. The system deletes the necessary records due to the merge, assigns new parent records to the child records, and sets the MasterRecordId field on the deleted records.
3. The after delete trigger fires.
4. The system does the specific updates required for the master record. Normal update triggers apply.

13. Use Salesforce Knowledge in Lightning Community
Salesforce Knowledge uses data categories to organize content. Lightning communities use topics. You can easily map the articles in your data categories to topics in a community. To map articles to topics automatically: In Experience Workspaces, click Content Management | Topics | Automatic Topic Assignment.
14. How to save the custom detail to a custom field on Chat Transcript object?
To save the custom detail to a custom field on LiveChatTranscript at the end of a chat, use the below
liveagent.addCustomDetail().saveToTranscript()

Example:
liveagent.addCustomDetail( ‘Company’, ‘Acme’ ).saveToTranscript( ‘Company__c’ );
Here Company__c is a custom field in Chat Transcript Object.
 
Reference Link:
https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_deployment_api_code_sample.htm

15. How to pass values from Start Chat button to Pre-Chat form in Salesforce?
To Pass values from Start Chat button to Pre-Chat Form, use addCustomDetail().
Example:
liveagent.addCustomDetail(‘test’,’Test Value’);

Use details attribute to capture the values in Pre-Chat form.

Reference Link:
https://help.salesforce.com/articleView?id=000338336&type=1&mode=1

Leave a Reply