Reports and Dashboards Folder Share Salesforce


View - Create and Edit their own Reports and Dashboards in the folder.
Edit - Create and Edit their own and others Reports and Dashboards in the folder.
Manage - View plus Edit and have the ability to manage the folder like sharing with others, changing description, etc.

Note:
Other profile permissions like Report Builder, Edit Reports, etc should be considered for viewing or modifying the report.

MuleSoft Interview Questions with Answers Part 1

1. YAML configuration files and Properties files in MuleSoft 
The Configuration Properties supports both YAML configuration files and Properties files. The recommended approach is to use a YAML configuration files, because it allows the addition of type validations and autocompletion.

2. Why APIs are abstraction layer?
APIs serve as a layer of abstraction between the data or function being provided and the logic required to complete and run a task at the source. In other words, your software just needs to know how to connect to the other system, not how the other system works.

3. Operational datastore
An operational data store (or "ODS") is used for operational reporting and as a source of data for the Enterprise Data Warehouse (EDW). It is a complementary element to an EDW in a decision support landscape and is used for operational reporting, controls and decision making, as opposed to the EDW, which is used for tactical and strategic decision support.

An ODS is a database designed to integrate data from multiple sources for additional operations on the data, for reporting, controls and operational decision support. Unlike a production master data store, the data is not passed back to operational systems. It may be passed for further operations and to the data warehouse for reporting.

An ODS should not be confused with an enterprise data hub (EDH). An operational data store will take transactional data from one or more production systems and loosely integrate it, in some respects, it is still subject-oriented, integrated and time-variant, but without the volatility constraints. This integration is mainly achieved through the use of EDW structures and content.

An ODS is not an intrinsic part of an EDH solution, although an EDH may be used to subsume some of the processing performed by an ODS and the EDW. An EDH is a broker of data. An ODS is certainly not.

Because the data originates from multiple sources, the integration often involves cleaning, resolving redundancy and checking against business rules for integrity. An ODS is usually designed to contain low-level or atomic (indivisible) data (such as transactions and prices) with a limited history that is captured "real-time" or "near real-time" as opposed to the much greater volumes of data stored in the data warehouse generally on a less-frequent basis.

General use
The general purpose of an ODS is to integrate data from disparate source systems in a single structure, using data integration technologies like data virtualization, data federation, or extract, transform, and load (ETL). This will allow operational access to the data for operational reporting, master data or reference data management.

An ODS is not a replacement or substitute for a data warehouse or for a data hub but in turn could become a source.

4. Difference between map and mapObject in DataWeave?
map to go through the elements in the "books" array.

mapObject to go through the keys and values in each of the objects of the array.

5. Define Leaf node
In computer science, a 'tree' is a widely used abstract data type (ADT)—or data structure implementing this ADT—that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes.

A node is a structure which may contain a value or condition, or represent a separate data structure (which could be a tree of its own). Each node in a tree has zero or more child nodes, which are below it in the tree (by convention, trees are drawn growing downwards). A node that has a child is called the child's parent node (or ancestor node, or superior). A node has at most one parent.

An internal node (also known as an inner node, 'inode' for short, or branch node) is any node of a tree that has child nodes. Similarly, an external node (also known as an outer node, leaf node, or terminal node) is any node that does not have child nodes.

6. OAuth 2.0
OAuth 2.0 is an open protocol that enables authentication, authorization, and secure data sharing between applications through the exchange of tokens.

7. API, Proxy and Gateway
An API is an interface that makes it easy for one application to 'consume' capabilities or data from another application. By defining stable, simplified entry points to application logic and data, APIs enable developers to easily access and reuse application logic built by other developers.

A proxy is something that acts as an intermediary, making requests on behalf of something else. A proxy can add some capabilities, like some basic security and monitoring, it really can’t do anything particularly sophisticated with content or routing, let alone transformation, mediation, or orchestration.

Most large businesses, organizations, and universities these days use a proxy server. This is a server that all computers on the local network have to go through before accessing information on the Internet. By using a proxy server, an organization can improve the network performance and filter what users connected to the network can access.

An API gateway on the other hand provides a much richer set of capabilities. When you use an API gateway to expose an API, you don’t even need to start with an API. You can take multiple existing services of varying types, and use the gateway to construct a modern, well-structured API. The gateway, of course, still offers the same capabilities that an API proxy would offer for security and monitoring, but it takes these and other capabilities much further.

A gateway is a hardware device that acts as a "gate" between two networks. It may be a router, firewall, server, or other device that enables traffic to flow in and out of the network.

8. What is Transport Layer Security (TLS)
Transport Layer Security (TLS) is a protocol that provides authentication, privacy, and data integrity between two communicating computer applications. It's the most widely-deployed security protocol used today and is used for web browsers and other applications that require data to be securely exchanged over a network, such as web browsing sessions, file transfers, VPN connections, remote desktop sessions, and voice over IP (VoIP).

Google Chrome
Connections are automatically negotiated at the highest grade.
If you are using Google Chrome version 22 or greater, TLS 1.1 is automatically supported.  TLS 1.1 & 1.2 are automatically enabled from version 29 onwards.

Microsoft Internet Explorer
Open Internet Explorer
From the menu bar, click Tools >  Internet Options > Advanced tab
Scroll down to Security category, manually check the option box for Use TLS 1.1 and Use TLS 1.2

Servers
Registry path: HKLM SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols

How to loop through Multi-Picklist Record Choice Sets in Salesforce Flows?

For basic Account Creation flow check - http://www.infallibletechie.com/2019/07/how-to-insert-data-using-flows-in.html

Sample Output:



Full Flow Diagram


1. Create a Record Choice Set variable for for Multi-Picklist.


2. Drag and drop multi-picklist into to screen.


3. Make sure SelectedContactIds(text data type) is assigned to Contacts(output of selected contacts from the Screen).


4. Create two Formula Fields like below.

currentContactId - Holds the first contact id if there are multiple selections.

TrimSelectedContact - Holds the rest of the ids except the first one.


5. Check Contacts Decision.
This decision is to check whether Contacts are selected in the first screen.


6. Check for semi colon Decision.
This decision is to check whether multiple contacts are selected.


No semi colon Decision outcome 



7. If semi colon is not found(only one record is selected), the flows goes to Assign Account Contact assignment and do the following.

a. Sets the Account__c as inserted account's id.
b. Sets the Contact__c as SelectedContactIds(which has just one id)
c. Sets the SelectedContactIds to null.


8. Add Acct Contact Assignment.
Adds the Account_Contact__c to the list of Account Contacts junction object Records list variable.


9. The flow goes to Check for Semi colon. Both the conditions doesn't satisfy. So, it goes to Default Outcome which directs them to create Account Contact junction object.

10. If multiple Contacts are selected, it goes to Assign Account Contact Fields Assignment.


11. It goes to Remove First Id Assignment.
Here it removes the first id from the SelectedContactIds.


12. It again goes to the step 7(Add Acct Contact Assignment) and repeats until for all the selected Contacts, list of Account Contacts are added and then goes to Create Account Contact to create the junction object records. 

Automation Testing Tools for Salesforce

Selenium
Open Source.

ProVarTesting - https://www.provartesting.com/
Provar helps you navigate the (ever-changing) Salesforce landscape with a code-free, point-and-click automated testing solution.

LeapWork - https://www.leapwork.com/discover/salesforce-automated-testing
Codeless UI automation.

Cigniti
Some of the Key Testing Services we offer are Functional, Unit, Regression, Governor Limit, Integration, Deployment, and Security. We also assist clients in performing User Acceptance Testing (UAT), Sandbox testing, UAT Support and Production Testing.

How to get all metadata using Visual Studio Code from Salesforce?

1. Install the below extension in Visual Studio Code.

https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator

2. Pres Ctrl + Shift + P.

3. Enter package and select Package.xml Generator: Choose Metadata Components.


4. Choose Metadata Components for Package.XML.


5. Click Update Package.xml button to update the package.xml file.

How to query record followed and the user id using SOQL?

SOQL:

SELECT Id, ParentId, SubscriberId FROM EntitySubscription

SubscriberId - ID of the User who is following the record or user.
ParentId - ID of the record or user which the user is following.

For additional fields, check the below link

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_entitysubscription.htm

Difference between for-in and for-of in JavaScript?

for-in
The for-in loop iterates over all the enumerable properties of an object. In each iteration the name of the property is stored in the variable.

Syntax:
for (variable in object)
    statement;

Example:
var obj = {x: 5, y: 'abc', z: true};
for (var prop in obj) {
    console.log(prop + " = " + obj[prop]);
}

for-of
The for-of iterates over iterable objects (arrays, maps, sets and others).

Syntax:
for (variable of object)
    statement;

In relation to the for-in loop, the for-of loop is a more convenient and iterates over property values.

Example:
var elements = ['a', 'b', 5, 6];
for (var element of elements) {
console.log(element);
}

Output:
//a
//b
//5
//6

Hide and Show components in Flow screen based on conditions in Salesforce?

Set Component Visibility in Salesforce Flow Screen.


Output:



Find Dynamic Dashboards in Salesforce

Run the below Query

SELECT Id, FolderName,Title FROM Dashboard WHERE Type IN ( 'LoggedInUser', 'MyTeamUser' )

(Or)

SELECT Id, FolderName,Title FROM Dashboard WHERE Type = 'LoggedInUser' OR Type = 'MyTeamUser'

If you are in the Developer console, click Open Detail Page to open the Dashboard.


How to Schedule Object data refresh in Salesforce Einstein Analytics?

1. Go to Data Manager.


2. Select Monitor.


3. Select Schedule.


How to get Salesforce Compliance documents like SOC1 and SOC2?

You need Salesforce login to get the  Salesforce Compliance documents like SOC1 and SOC2.

You can use your username and password in the below URL and download the documents.

https://compliance.salesforce.com/en

For additional documents, you may have to reach out to your Salesforce Account Executive.

How to protect against SOQL injection vulnerabilities?

How to protect against SOQL injection vulnerabilities?
Static Query and Bind Variables
The first and most recommended method to prevent SOQL injection is to use static queries with bind variables. Consider the following query.Static Query:
SELECT Id FROM Contact WHERE Name LIKE: var

String query = ‘select id from contact where firstname =\’’+var+’\’’;
queryResult = Database.execute(query);

Using user input (the var variable) directly in a SOQL query opens the application up to SOQL injection. To mitigate the risk, translate the query into a static query like this one.
queryResult = [select id from contact where firstname =:var];

Typecasting
Another strategy to prevent SOQL injection is to use typecasting. By casting all variables as strings, user input can drift outside of expectation. By typecasting variables as integers or Booleans, when applicable, erroneous user input is not permitted.

Escaping Single Quotes
Another XSS mitigation option that is commonly used by developers who include user-controlled strings in their queries is the platform-provided escape function String.escapeSingleQuotes().

If you must use dynamic SOQL, use the escapeSingleQuotes method to sanitize user-supplied input. This method adds the escape character (\) to all single quotation marks in a string that is passed in from a user. The method ensures that all single quotation marks are treated as enclosing strings, instead of database commands.

Whitelisting
Create a list of all “known good” values that the user is allowed to supply. If the user enters anything else, you reject the response.

Replacing Characters
A final approach for your tool belt is character replacement, also known as blacklisting. This approach removes “bad characters” from user input.

Check the below Example
SOQL:
'SELECT Id, AccountNumber, Name, Amount__c FROM Account WHERE IsActive = ' + var;
If someone enters "true AND AccountNumber = 100", they will get all info about Account with Account Number "100".
We can use the below code
var.replaceAll('[^\w]','');
This will remove all the whitespaces. So, that the query becomes invalid( SELECT Id, AccountNumber, Name, Amount__c FROM Account WHERE IsActive = trueANDAccountNumber=100 )

How to deploy custom metadata type using Apache ANT tool in Salesforce?

Use the below package.xml to deploy custom metadata type using Apache ANT tool in Salesforce.

package.xml:

  1. <!-- Custom Metadata Type Data -->  
  2. <types>  
  3.     <members>CustomMetadata__mdt.RecordName</members>  
  4.     <name>CustomMetadata</name>  
  5. </types>  
  6.   
  7. <!-- Custom Metadata Type -->  
  8. <types>  
  9.     <members>CustomMetadata</members>  
  10.     <name>CustomObject</name>  
  11. </types>  

How to find which license types/Profiles support OAuth login from external apps in Salesforce?

How to find which license types/Profiles support OAuth login from external apps in Salesforce?

1. Go to App Manager.


2. Select the Connected App created for OAuth. Select Manage from the Actions Menu.


3. In the OAuth Policies section, set Permitted Users to Admin approved users are pre-authorized.


4. Select Manage Profiles to find.


How to get the label Name for Object's field in Salesforce?

How to get the label Name for Object's field in Salesforce?
Sample Code:

system.debug( 'Field Label Name is ' + Opportunity.StageName.getDescribe().getLabel() );

Output:


Salesforce Formula field to download the file

Below formula can be used

HYPERLINK("/sfc/servlet.shepherd/version/download/"&ContentVersionId, "Name" ,"_blank")

ContentVersion Id starts with 068.

ContentDocument Id starts with 069.

lightning-record-edit-form and lightning-record-view-form example Salesforce LWC

lightning-record-edit-form and lightning-record-view-form example Salesforce LWC

Aura Component:

  1. <aura:component implements="force:lightningQuickAction,force:hasRecordId">  
  2.     <c:caseEscalation recId="{!v.recordId}"/>  
  3. </aura:component>   

LWC HTML:

  1. <template>  
  2.   
  3.         <div class="slds-m-around_medium">     
  4.   
  5.             <template if:true={newBool}>  
  6.                   
  7.                     <lightning-record-edit-form object-api-name="Case"  
  8.                                                 onsuccess={handleCreate}  
  9.                                                 record-type-id="0123i000000IC1dAAG">  
  10.                         <lightning-messages></lightning-messages>  
  11.                         <div class="slds-grid slds-wrap">  
  12.                             <div class="slds-col slds-size_1-of-2">                              
  13.                                 <lightning-input-field field-name="Subject">  
  14.                                 </lightning-input-field>  
  15.                             </div>  
  16.                             <div class="slds-col slds-size_1-of-2">  
  17.                                 <lightning-input-field field-name="Status">  
  18.                                 </lightning-input-field>  
  19.                             </div>  
  20.                             <div class="slds-col slds-size_1-of-2">                              
  21.                                 <lightning-input-field field-name="Reason">  
  22.                                 </lightning-input-field>  
  23.                             </div>  
  24.                             <div class="slds-col slds-size_1-of-2">  
  25.                                 <lightning-input-field field-name="Origin">  
  26.                                 </lightning-input-field>  
  27.                             </div>  
  28.                             <div class="slds-col slds-size_1-of-2">  
  29.                                 <lightning-input-field field-name="ParentId" value={recId}>  
  30.                                 </lightning-input-field>  
  31.                             </div>  
  32.                         </div>  
  33.                         <lightning-button class="slds-m-top_small"  
  34.                                             type="submit"  
  35.                                             label="Create new">  
  36.                                             </lightning-button>  
  37.                     </lightning-record-edit-form>  
  38.       
  39.             </template>  
  40.   
  41.             <template if:true={parentCaseId}>                      
  42.   
  43.                 <template if:true={viewBool}>  
  44.                   
  45.                         <lightning-record-view-form record-id={parentCaseId}  
  46.                                                     object-api-name="Case">  
  47.                             <div class="slds-grid slds-wrap">  
  48.                                 <div class="slds-col slds-size_1-of-2">                              
  49.                                     <lightning-output-field field-name="Subject">  
  50.                                     </lightning-output-field>  
  51.                                 </div>  
  52.                                 <div class="slds-col slds-size_1-of-2">  
  53.                                     <lightning-output-field field-name="Status">  
  54.                                     </lightning-output-field>  
  55.                                 </div>  
  56.                                 <div class="slds-col slds-size_1-of-2">                              
  57.                                     <lightning-output-field field-name="Reason">  
  58.                                     </lightning-output-field>  
  59.                                 </div>  
  60.                                 <div class="slds-col slds-size_1-of-2">  
  61.                                     <lightning-output-field field-name="Origin">  
  62.                                     </lightning-output-field>  
  63.                                 </div>  
  64.                             </div>  
  65.                         </lightning-record-view-form>  
  66.   
  67.                 </template>  
  68.                   
  69.                 <template if:true={editBool}>  
  70.   
  71.                     <lightning-record-edit-form record-id={parentCaseId}  
  72.                                                 object-api-name="Case"  
  73.                                                 onsuccess={handleSuccess}>  
  74.                         <lightning-messages>  
  75.                         </lightning-messages>  
  76.                         <div class="slds-grid slds-wrap">  
  77.                             <div class="slds-col slds-size_1-of-2">                              
  78.                                 <lightning-input-field field-name="Subject">  
  79.                                 </lightning-input-field>  
  80.                             </div>  
  81.                             <div class="slds-col slds-size_1-of-2">  
  82.                                 <lightning-input-field field-name="Status">  
  83.                                 </lightning-input-field>  
  84.                             </div>  
  85.                             <div class="slds-col slds-size_1-of-2">                              
  86.                                 <lightning-input-field field-name="Reason">  
  87.                                 </lightning-input-field>  
  88.                             </div>  
  89.                             <div class="slds-col slds-size_1-of-2">  
  90.                                 <lightning-input-field field-name="Origin">  
  91.                                 </lightning-input-field>  
  92.                             </div>  
  93.                         </div>  
  94.                         <lightning-button  
  95.                             class="slds-m-top_small"  
  96.                             variant="brand"  
  97.                             type="submit"  
  98.                             name="update"  
  99.                             label="Update">  
  100.                         </lightning-button>  
  101.                     </lightning-record-edit-form>  
  102.   
  103.                 </template>  
  104.   
  105.             </template >  
  106.   
  107.         </div>  
  108.       
  109. </template>  

LWC JS:

  1. import { LightningElement, api, wire, track } from 'lwc';  
  2. import fetchCase from '@salesforce/apex/CaseEscalationController.fetchCase';  
  3. import { ShowToastEvent } from 'lightning/platformShowToastEvent';  
  4.   
  5. export default class CaseEscalation extends LightningElement {  
  6.   
  7.     @api recId;  
  8.     @track parentCaseId;  
  9.     @track viewBool;  
  10.     @track editBool;  
  11.     @track newBool;  
  12.   
  13.     @wire(fetchCase, { strRecordId: '$recId' })  
  14.     caseRecord({ error, data }) {  
  15.   
  16.         if ( data ) {  
  17.   
  18.             this.parentCaseId = data.Id;  
  19.   
  20.         }   
  21.         if ( this.parentCaseId ) {  
  22.   
  23.             this.newBool = false;  
  24.             this.editBool = true;  
  25.   
  26.         } else{  
  27.               
  28.             this.newBool = true;  
  29.             this.editBool = false;  
  30.   
  31.         }  
  32.         this.viewBool = false;  
  33.           
  34.     }  
  35.   
  36.     handleSuccess( event ) {  
  37.           
  38.         const toastEvent = new ShowToastEvent({  
  39.             title: 'Case Updated',  
  40.             message: 'Case Updated Successfully!!!',  
  41.             variant: 'success'  
  42.         });  
  43.         this.dispatchEvent( toastEvent );  
  44.         this.viewBool = true;  
  45.         this.editBool = false;  
  46.         this.newBool = false;  
  47.   
  48.     }  
  49.   
  50.     handleCreate( createEvent ) {  
  51.           
  52.         const toastEvent = new ShowToastEvent({  
  53.             title: 'Case Created',  
  54.             message: 'Case Created Successfully!!!',  
  55.             variant: 'success'  
  56.         });  
  57.         this.dispatchEvent( toastEvent );  
  58.         this.viewBool = true;  
  59.         this.editBool = false;  
  60.         this.newBool = false;  
  61.         this.parentCaseId = createEvent.detail.id;  
  62.   
  63.     }  
  64.   
  65. }  

LWC JS-META.XML:

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="CaseEscalation">  
  3.     <apiVersion>47.0</apiVersion>  
  4.     <isExposed>false</isExposed>    
  5.     <targets>      
  6.         <target>lightning__RecordPage</target>      
  7.     </targets>      
  8.     <targetConfigs>      
  9.         <targetConfig targets="lightning__RecordPage">      
  10.             <property name="recId" type="String" label="Record Id" description="Record Id"/>      
  11.         </targetConfig>    
  12.     </targetConfigs>     
  13. </LightningComponentBundle>  

Apex Class:

  1. public class CaseEscalationController {  
  2.       
  3.     @AuraEnabled( cacheable=true )      
  4.     public static Case fetchCase( String strRecordId )  {   
  5.           
  6.         system.debug( 'Id is ' + strRecordId );  
  7.         List < Case > listCases = [ SELECT Id FROM Case WHERE ParentId =: strRecordId LIMIT 1 ];  
  8.           
  9.         if( listCases.size() > 0 )  
  10.             return listCases.get( 0 );  
  11.         else  
  12.             return null;  
  13.           
  14.     }  
  15.   
  16. }  

Output:
Case without already created Escalation Case(Case not tied to the viewing Case through Parent Case)


Case with already created Escalation Case(Case tied to the viewing Case through Parent Case)