Simple Custom Lightning Template

Sample Code:

Component:

  1. <aura:component implements="lightning:recordHomeTemplate">  
  2.       
  3.     <aura:attribute name = "left" type = "Aura.Component[]" />  
  4.     <aura:attribute name = "middle" type = "Aura.Component[]" />  
  5.     <aura:attribute name = "right" type = "Aura.Component[]" />  
  6.       
  7.     <div>  
  8.           
  9.         <lightning:layout >  
  10.               
  11.             <lightning:layoutItem size = "2">  
  12.                   
  13.                 {!v.left}  
  14.                   
  15.             </lightning:layoutItem>  
  16.               
  17.             <lightning:layoutItem size = "5">  
  18.                   
  19.                 {!v.middle}  
  20.                   
  21.             </lightning:layoutItem>  
  22.               
  23.             <lightning:layoutItem size = "5">  
  24.                   
  25.                 {!v.right}  
  26.                   
  27.             </lightning:layoutItem>  
  28.               
  29.         </lightning:layout>  
  30.           
  31.     </div>  
  32.       
  33. </aura:component>  

Design:

  1. <design:component>  
  2.       
  3.     <flexipage:template >  
  4.           
  5.         <flexipage:region name = "left" defaultwidth = "Medium"/>  
  6.           
  7.         <flexipage:region name = "middle" defaultwidth = "Xlarge"/>  
  8.           
  9.         <flexipage:region name = "right" defaultwidth = "Xlarge"/>  
  10.           
  11.     </flexipage:template>  
  12.       
  13. </design:component>  

Output:


How to adjust left and side bar width in Salesforce Service Cloud Console?

1. Go to the object page layout.

2. Click Edit button.


3. Go to Custom Console Components.


4. Adjust the width.


Output:


How to find profile permissions for objects in Salesforce?

Sample SOQL:

  1. SELECT Parent.Profile.Name, sObjectType, PermissionsCreate, PermissionsRead, PermissionsEdit, PermissionsDelete, PermissionsModifyAllRecords,   
  2.        PermissionsViewAllRecords   
  3.   FROM ObjectPermissions   
  4.  WHERE ParentId IN ( SELECT Id   
  5.                        FROM permissionset                       
  6.                       WHERE PermissionSet.Profile.Name IN ( 'System Administrator''Read Only' ) ) ORDER BY sObjectType, Parent.Profile.Name  

The above SOQL will give profile name, object name, create access, read access, edit access, delete access, modify all access and view all access.

Execute the SOQL in Data Loader to extract the values.

How to Monitor Your Processes’ Pending Scheduled Actions in Salesforce?

To see which of your processes are still waiting to execute scheduled actions, see the Paused and Waiting Interviews list on the flow management page.

1. Go to Flows.


2. Check Paused and Waiting Interviews section.


What emails are included in the "System Email Only" in Email Administration in Salesforce?


“System email only” means that Salesforce will only send system-related such as below

1. Email Address Change

2. Security Token Reset

3. Inbound and Outbound Change Sets

4. Sandbox about to expire

5. Password Reset

6. New user password notification

7. API failure notifications

How to mass Confirm Email Address in Salesforce?

1. Create Bounced Email report in Salesforce.


2. Use Dataloader or execute the below code in Developer Console.

  1. List < Lead > listLeads = [ SELECT Id, EMAILBOUNCEDDate   
  2.                               FROM Lead   
  3.                              WHERE EMAILBOUNCEDREASON = '550 5.7.1 Relaying denied' AND EMAILBOUNCEDDate = YESTERDAY   
  4.                              LIMIT 300 ] ;  
  5. for ( Lead obj : listLeads ) {  
  6.       
  7.     obj.EMAILBOUNCEDDate = null;  
  8.     obj.EMAILBOUNCEDREASON = null;  
  9.       
  10. }  
  11. update listLeads;  

Note:
Update the report filter and SOQL filter accordingly.


Lightning Record Pages API Names

Header and Left Sidebar - flexipage:recordHomeLeftSidebarTemplateDesktop

Header and Right Sidebar - flexipage:recordHomeTemplateDesktop


Salesforce Interview Questions with Answers Part 53

1. What is the use of a data category?

Data categories are used in Salesforce Knowledge (articles and article translations), Ideas, Answers, and Chatter Answers to help classify and find articles, questions, or ideas. You can use data categories to control access to a particular set of articles, questions or ideas.

Set data category visibility on profiles to control which user profile has access to the articles with that data category.

2. Article Actions

a. Read article action.
b. Manage Article permission and Read, Create, and Edit article actions.
c. Manage Article permission and Read, Create, Edit, Archive, Publish, and Delete article actions.

3. What is the use of Data Group?

Once you have category groups, you can add data categories to help agents classify and find articles, questions, or ideas.

4. What is the use of the Entitlement Process?

Entitlement processes are timelines that include all of the steps (milestones) that your support team must complete to resolve cases or work orders.

In Salesforce, an entitlement process is a set timeline for resolving cases and work orders.

5. What is the difference between an API Gateway and API Manager?

API Gateway
An API Gateway is a server that is the single entry point into the system. It is similar to the Facade pattern from object‑oriented design. The API Gateway encapsulates the internal system architecture and provides an API that is tailored to each client. It might have other responsibilities such as authentication, monitoring, load balancing, caching, request shaping and static response handling.

API Management
API management is the process of publishing, promoting and overseeing APIs in a secure, scalable environment. It also includes the creation of end user support resources that define and document the APIs.

6. Automatically Get Geocodes for Addresses fields in Salesforce

Geocodes identify a location using latitude and longitude. Geocodes also have an associated accuracy rating. Geocodes are added to the pre-existing latitude and longitude fields on accounts, contacts, and leads. The accuracy field is also populated. By default, these fields aren’t visible on records, but you can check them out in a few ways, including using custom formula fields and querying the Salesforce API.

Geocodes are added only for some standard addresses.

Billing Address on accounts
Shipping Address on accounts
Mailing Address on contacts
Address on leads

7. Differences between Last Activity and Last Modified Dates

Last Modified 
The date and timestamp for changes made to an individual record and includes the User who made the change.

Last Activity 
The date when a User last did something related to the record (represents one of the following):

The latest Due Date of the Closed Tasks on a record.
The latest Date of Events on a record.

Example: If a Record has multiple Activities, the "Last Activity" date will be the Due Date of the Activity furthest in the future. If the Activity Due Dates are 1/10/2018 and 2/10/2018, the Last Activity will be 2/10/2018.

Note:
A single Task may be related to more than one record. For example, a Task may be related to both an Account and an Opportunity or both a Contact and a Case. Make sure that records actually reflect last activities by using the "Related To" field whenever you log a call, create a Task, send an email, or schedule an Event.

8. Fields supported in sObject with dot notation

The only field is supported for sObject is Id.

Example:

sObject sObj = [ SELECT Id, Name FROM Account LIMIT 1 ];

Id acctId = sObj.Id;//Supported

String acctName = sObj.Name;//Not Supported and you cannot save the code

9. How to test Batch Apex result in Test class in Salesforce?

The call to Database.executeBatch should be included within the Test.startTest and Test.stopTest block. The job executes after the call to Test.stopTest. Any asynchronous code included within Test.startTest and Test.stopTest is executed synchronously after Test.stopTest.

10.  @isTest(isParallel=true) annotation in Salesforce

Use the @isTest(isParallel=true) annotation to indicate test classes that can run in parallel and aren’t restricted by the default limits on the number of concurrent tests. This makes the execution of test classes more efficient because more tests can be run in parallel.

This annotation overrides the default settings that disable parallel testing. A test class that doesn’t have this annotation is restricted by the default limits on the number of concurrent tests.

11. Cases related list in Opportunity

Shows all the cases related to the Opportunity's Account.

Note:
There is no Lookup(Opportunity) in Case object.

12. An asset in CPQ salesforce

Salesforce CPQ creates assets when you click Contracted on an opportunity or order. The asset creation process varies based on your account’s renewal model and the value of the asset conversion field on the product you’re contracting.

Let’s review all the options for your asset conversion field.

a. One per unit: Salesforce CPQ creates one asset record for each unit of the quote line as indicated by its quantity. For example, a quote line with a quantity of five for a non-subscription product would create five asset records each with a quantity of one.
b. One per quote line: Salesforce CPQ creates one asset record that represents the entire quantity of the quote line or order product. For example, a quote line with a quantity of five for a non-subscription product would create one asset record with a quantity of five.
c. None: Salesforce CPQ doesn’t convert this quote line to an asset. This setup is useful if you’re selling a one-time product that you don’t need to renew or track. For example, you could sell a software license subscription and then include a product that represents a user training class. Your customers continue to renew the subscription, but they don’t need to renew or track the training class.

13. tabIndex and tabOrderHint

The tabOrderHint attribute is used as a hint when calculating the value to set for the tabIndex value of the rendered HTML element or elements. It’s used to indicate the relative order in which the field is selected compared to other page components. This value must be an integer between 1 and 3276, or an expression which evaluates to an integer value in the same range. The tab order begins with component 1 being the first component selected when a user presses TAB.

The tabIndex attribute is used to directly set the tabIndex value of the rendered HTML element. It’s an absolute index setting the order in which the field is selected, compared to other page components. This value must be an integer between 0 and 32767, or an expression which evaluates to an integer value in the same range. The tab order begins with component 0 being the first component selected when a user presses TAB.

The tabOrderHint attribute is available on only the <apex:inputField> component. The tabIndex attribute can be set on the following Visualforce components.

<apex:commandButton>
<apex:commandLink>
<apex:inputCheckbox>
<apex:inputFile>
<apex:inputSecret>
<apex:inputText>
<apex:inputTextarea>
<apex:outputLabel>
<apex:outputLink>
<apex:selectCheckboxes>
<apex:selectList>
<apex:selectRadio>

When mixing <apex:inputField> with components that use the tabIndex attribute to set the tab order, you can multiply the tabOrderHint by 10 to get the approximate equivalent value of the tabIndex for that field. Use this to manually calculate equivalent values to set the appropriate attribute on each of the components in such a way as to set the desired tab order for all elements on the page.

14. What is ERP?

Enterprise Resource Planning (ERP) integrates functions into one system to align processes and information across the organization.

Those functions include:

Accounting
Procurement/Accounts Payable
General Ledger
Fixed Assets
Cash Management
Reconciliations
Reporting
Inventory and order management
Supply planning
Warehouse Management

Salesforce error 550 5.7.0 Mail relay denied

This issue happens when Email Relay is set up in your Salesforce org and the IPs are not whitelisted properly in the email Server.

Go to https://help.salesforce.com/articleView?id=000003652&type=1 to find the IP ranges.

If you have enabled email relaying you will need to allow mail from the IP address which we use to send system email, Chatter and Communities mail, and those Salesforce uses for email relaying.

Sample IPs in the article:


How to view Page Performance by Browser and Other New Metrics in the Lightning Usage App?

You can now view more metrics in the Lightning Usage App, including page performance by browser. You can also generate reports using the Lightning Usage App objects.



What happens when we Freeze user accounts in Salesforce?

1. Freezing user accounts doesn't free the user licenses available for use in your organization.

2. Manual Sharing is not deleted.

3. User license of that user will not be released.

This is mainly used if you want to restrict a user to login during any activity.

Check the below link for Freezing and Unfreezing the users.

http://www.infallibletechie.com/2013/10/freeze-button-in-salesforce-user-detail.html

How to find created or inserted data when we set audit field values for imported records (Created By, Created Date, Last Modified By ID, Last Modified Date)?

Let's say, Account records are inserted with audit field values. You can use the below query to find

  1. SELECT Id, Name FROM Account WHERE DAY_ONLY ( SystemModStamp ) = TODAY  

SystemModStamp is strictly read-only. Not only is it updated when a user updates the record, but also when automated system processes update the record. Because of this behavior, it creates a difference in stored value where ‘LastModifiedDate <= SystemModStamp’ but never ‘LastModifiedDate > SystemModStamp’.

To understand the usage of SystemModStamp, check the below link for more information

http://www.infallibletechie.com/2015/07/what-is-difference-between.html

How to get all related objects for an object in Salesforce?

Sample code:


  1. for ( ChildRelationship r: Opportunity.SObjectType.getDescribe().getChildRelationships() )  
  2.     system.debug( string.valueOf( r.getChildSObject() ) );  

Output:



How to deactivate a Push Topic in Salesforce?

You can temporarily deactivate a PushTopic, rather than deleting it, by setting the isActive field to false.

To deactivate a PushTopic,

1. Run the below SOQL in Developer Console

  1. SELECT Id, Name, IsActive FROM PushTopic  

2. Set IsActive = false and click Save Rows button.


How to get All Date of Birth Fields in Salesforce?

Sample Code:


  1. Set < String > listsObjs = new Set < String > {'Account''Lead'};      
  2. Map<String, Schema.SObjectType > globalDescription = Schema.getGlobalDescribe();   
  3.         
  4. for ( String obj : listsObjs ) {  
  5.   
  6.     Schema.sObjectType objType = globalDescription.get( obj );  
  7.     Schema.DescribeSObjectResult r1 = objType.getDescribe();   
  8.     Map<String , Schema.SObjectField > mapFieldList = r1.fields.getMap();    
  9.   
  10.     for ( Schema.SObjectField field : mapFieldList.values() ) {    
  11.       
  12.         Schema.DescribeFieldResult fieldResult = field.getDescribe();    
  13.         String fieldLabel = fieldResult.getLabel().toLowerCase();  
  14.         Schema.DisplayType fielddataType = fieldResult.getType();  
  15.   
  16.         if ( ( fielddataType == Schema.DisplayType.Date || fielddataType == Schema.DisplayType.DateTime ) &&   
  17.             ( fieldLabel.contains( 'DOB' ) || fieldLabel.contains( 'date of birth' )   
  18.               || fieldLabel.contains( 'dateofbirth' ) || fieldLabel.contains( 'birthday' ) )   
  19.             && ! fieldResult.isCalculated() ) {  
  20.           
  21.             System.debug ( objType + '.' + fieldResult.getName() );  
  22.           
  23.         }  
  24.           
  25.     }  
  26.       
  27. }  


In the Developer Console, select Debug Only to see the debug logs.


Salesforce Lightning Dialer

Use Lightning Dialer to access telephony features without ever leaving Salesforce. Make and receive calls, add call notes, and log call information with ease. It just takes a single click from phone number fields in Lightning Experience, such as numbers on contacts, leads, and list views.



How to Update Chatter Stream Notification in Salesforce?

1. Go to Chatter tab.

2. Select the Chatter Stream.

2. Click Notifications to adjust.


What happens when the user is inactivated or deactivated in Salesforce?

You can’t delete a user, but you can deactivate an account so a user can no longer log in to Salesforce.

If an user is inactivated,

1. He will not be able to login.
2. Report will not run, if he/she is set as running user.
3. Web to lead and web to case will not work, if he is set as the default creator.
4. User license of the inactivates user will be free for other user.
5. Deactivated users lose access to any records that were manually shared with them, or records that were shared with them as team members. Users higher in the role hierarchy relative to the deactivated users also lose access to those records.
6. Deactivated users are removed from the default opportunity and account teams of other users. The deactivated users' default opportunity and account teams are not removed.
7. If a user on an account team has Read/Write access (Account Access, Contact Access, Opportunity Access, and Case Access) and is deactivated, the access will default to Read Only if the user is reactivated.
8. If you deactivate users in an organization where opportunity splitting is enabled, they aren’t removed from any opportunity teams where they’re assigned a split percentage.

This is mainly done, when the user leaves the organization.

Salesforce help article - https://help.salesforce.com/articleView?id=users_deactivate_considerations.htm&type=5

Accounts records deletion consideration in Salesforce

1. You cannot delete Accounts if it has cases related to it.

2. If you delete the Account, it's related Assets will also gets deleted.

3. Deletes related Contacts.

4. You cannot delete Accounts if it has closed won opportunities related to it. If all the opportunities related to it are open, then the account can be deleted.

5. It deletes Contracts (if they're not activated).

6. You cannot delete an account which has related Service Contracts.

NOTE:
You don’t need the Delete permission on any associated records that are included in the deletion.

How to test Batch Apex result in Test class in Salesforce?

The call to Database.executeBatch should be included within the Test.startTest and Test.stopTest block. The job executes after the call to Test.stopTest. Any asynchronous code included within Test.startTest and Test.stopTest is executed synchronously after Test.stopTest.

Sample Batch Apex:


  1. global class AccountBatch Implements Database.Batchable <sObject> {  
  2.   
  3.     global Database.queryLocator start( Database.BatchableContext bc ) {  
  4.       
  5.         String SOQL = 'SELECT Id, Industry FROM Account';  
  6.         return Database.getQueryLocator(SOQL);  
  7.           
  8.     }  
  9.   
  10.     global void execute( Database.BatchableContext bc, List < Account > listAccounts ) {  
  11.       
  12.         for ( Account objAct : listAccounts ) {  
  13.           
  14.             objAct.Industry = 'Energy';  
  15.               
  16.         }  
  17.       
  18.         update listAccounts;  
  19.           
  20.     }  
  21.   
  22.     global void finish( Database.BatchableContext bc ) {  
  23.       
  24.         AsyncApexJob a = [ SELECT Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedById    
  25.                              FROM AsyncApexJob    
  26.                             WHERE Id =: bc.getJobId() ];    
  27.         Messaging.SingleEmailMessage batchEmail = new Messaging.SingleEmailMessage();    
  28.         batchEmail.setTargetObjectId( a.CreatedById );    
  29.         batchEmail.setSubject( 'Asset Delete Batch ' + a.Status );    
  30.         batchEmail.setPlainTextBody( 'Jobs processed ' + a.JobItemsProcessed + ' with '+ a.NumberOfErrors + ' failures.' );    
  31.         batchEmail.setSaveAsActivity( false );    
  32.         Messaging.sendEmail( new Messaging.SingleEmailMessage[] { batchEmail } );   
  33.           
  34.     }  
  35.   
  36. }  

Sample Test class:


  1. @isTest  
  2. private class AssetDeleteBatchTest {  
  3.       
  4.     static testMethod void testAssetsDel() {  
  5.           
  6.         List < Account > insertAcc = new List< Account >();  
  7.         for ( Integer a = 0; a < 3; a++ ) {  
  8.           
  9.             Account acc = new Account( Name = 'Test Account' + String.valueOf( a ), Industry = 'Biotechnology' );  
  10.             insertAcc.add( acc );  
  11.                   
  12.         }  
  13.         insert insertAcc;  
  14.           
  15.         Test.startTest();  
  16.         AccountBatch obj = new AccountBatch();  
  17.         Database.executeBatch( obj );  
  18.         Test.stopTest();  
  19.           
  20.         /* 
  21.             Once Test.stopTest() hits, the batch job runs synchronously. 
  22.             Once the batch job execute method is completed, the below codes are executed. 
  23.         */  
  24.         List < Account > listAccounts = [ SELECT Id FROM Account WHERE Industry = 'Energy' ];  
  25.         system.assertEquals( 3, listAccounts.size() );  
  26.           
  27.     }  
  28.       
  29. }