September 11, 2019

Assets best practices in Salesforce

Assets allow you to track specific information about the products and services purchased or installed by customer accounts or contacts Use assets to track everything you need to know about a customers existing products.

While products represent the items that your company sells, assets represent the specific products your customers have purchased. Use assets to store information about your customers' products.

Best practice in using Assets in Salesforce:
1. Assets should be created when Opportunity is closed won. Products used in the opportunity should be used for creating it. Account from Opportunity and Product related to Opportunity should be populated on the Asset. Opportunity Line Item can be used for Product code, Quantity and Price.
2. Asset should be linked to the Opportunity's Account.
3. Use Competitor Asset check box to track Competitor assets.
4. Work Order creation and Parts Requests can start from Asset in Salesforce for tracking.
5. Asset Replacements
When a customer’s asset needs to be replaced or upgraded, track the replacement in Salesforce on asset detail pages.
a. The Primary Assets related list shows assets that replaced the current asset.
b. The Related Assets related list shows assets that the current asset replaced.
6. You can create asset hierarchies to represent products with multiple components, and view a tree grid of an asset’s hierarchy on its detail page. On the support side, assets can be linked to cases, work orders, maintenance plans, entitlements, and contract line items, making it easy to see an asset’s history from production to retirement.

a. To view Asset Hierarchy, click View Asset Hierarchy button.



b. To add related assets or to link it to Parent asset use Child Assets Related list and Parent Asset field on the child Asset.



August 31, 2019

In-App Guidance in Salesforce Lightning

Add guidance in your app to get your users' attention. Use prompts to onboard and train users, highlight configuration changes and news, introduce new features, and more. You get to write the content, pick the target audience, and specify where it appears and for how long. If you've installed packages that include in-app guidance, they're listed as well.

1. Go to In-App Guidance in the Setup.


2. Click Add Prompt.

3. Click Open Authoring Bar.

4. Navigate to the app and page where you want to add your prompt and click Add Prompt button.

5. Select Type, Position, Permissions, Content, Schedule and Details.

6. Click Done.

Sample:



August 30, 2019

How to create a Joined Report in Salesforce to Show Parent and its related data in a Single Report?

Check the below steps to create a single joined report to show Account and its related Contacts, Cases and Opportunities.

1. Create a Joined Report.

2. Select Accounts, Contacts, Opportunities and Cases report types for each block.

3. In Group By, select Account Name.



August 27, 2019

Email Opt Out in Salesforce Sales and Service Cloud

Sales and Service cloud is not marketing platform like Marketing Cloud. So, the Email Opt Out field in Salesforce works as below.

The Email Opt Out field will allow you to exclude marked contacts from mass e-mail.

Email Opt Out field shows a message/warning when the user tries to send an email.


This field doesn't block to send email. Check in apex, workflow rule and process builder before sending email alerts.

Note:
Make use of Individual object in Salesforce to handle Email Privacy Settings.

Check the below link for more information

https://www.infallibletechie.com/2018/03/what-is-use-of-individual-object-and.html

August 20, 2019

Salesforce Winter '20 Release Highlights/Overview

Access the Recycle Bin in Lightning Experience
You no longer have to switch to Salesforce Classic to access the Recycle Bin. You can now view, restore, and permanently delete the items in your Recycle Bin and the org Recycle Bin.

Access the Recycle Bin by selecting it in the App Launcher under All Items or personalizing your navigation bar. Or add the Recycle Bin tab for your org in the Lightning App Builder.

The Recycle Bin in Lightning Experience works the same as it does in Salesforce Classic, except for a few differences. In Lightning Experience:
  1. The org’s Recycle Bin is called Org Recycle Bin (1). The Salesforce Classic name is All Recycle Bin.
  2. Restore records by clicking Restore (2) instead of Undelete in Salesforce Classic.
  3. Permanently delete records by selecting them and clicking Delete (3) versus Undelete or Empty in Salesforce Classic.
  4. You can’t restore reports and dashboards. Switch to Salesforce Classic to access them in the Recycle Bin.
Make Your List Views Stay on Topic with Topic Filters
Keep your list views #organized by adding filters based on topics. You can add filters for up to two topics per list view.

To enable Topics in Salesforce Lightning Experience, check the below link




Save Ink and Paper with Printable View for Lists
You don’t have to print your entire screen just to make a hard copy of your list. Generate a condensed, minimalist, ink-saving view of your lists and related lists with Printable View.



View More Fields in the Record Highlights Panel in Salesforce mobile App
Your reps have access at the top of their record pages to more of the information that they use most. We increased the number of compact layout fields that display in the highlights area from 4 to 10.

Complete Tasks in a Single Click
Now sales reps can mark tasks complete from table view. This means reps can spend more time getting things done and less time crossing them off their list.


Find Email File Attachments in One Click
Now it’s easy to send files as an email attachment. When reps choose files to attach to an email, they can use the new Related Files link. Click the link to show all the files that are part of the record. This feature applies to all activity-enabled objects, such as leads, contacts, person accounts, opportunities, cases, and custom objects.


Add Inline Images to Emails in a Flash
Now it’s faster to add images to emails. Copy and paste images from the internet and from other applications directly into the email composer without saving the image first.


Add a Signature to Email Templates
With the new {{{Sender.Signature}}} merge field, email template creators can include a sender’s existing signature in an email template. The field is available wherever the merge field picker exists, including in emails, list emails, and enhanced letterheads.


Find Important Email Templates Quickly
We improved the Insert Email Template modal to make the templates that sales reps use most easier to find. Plus, reps can see the template details that they need.

Salesforce remembers the last template category and folder the rep used. Reps can see all the text in the Description and Folder columns by selecting Wrap Text.

We removed the Created By, Created Date, and Delete columns so that reps can focus on the most important information.


Scan and Scroll the Activity Timeline
Improvements to the activity timeline make scanning, finding, and acting on activities easier for your sales reps. Infinite scrolling eliminates clicks and eases scanning for the activity that a rep is looking for. No more Load More Activities button. Grouping activities in the activity timeline by month lets reps find activities quickly and make sense of periods of time without customer activity. Relative dates, for example, one, two, or three months ago, let reps see the pace of activities.
Monthly groups of activities make it easier to find that event in May or the email received three months ago.


View Opportunities Owned by Your Team with One Click in Lightning Experience
The new My team’s opportunities list view is based on role hierarchy. Sales managers can use it to easily see all the opportunities owned by their direct and indirect reports without creating a list view.


Evaluate Each Record in Reports with Row-Level Formulas (Generally Available)

Now that row-level formulas are generally available, these actions are supported.

  1. Filter and group report data by row-level formulas.
  2. Sort groups by row-level formulas.
  3. Reference row-level formulas in summary formulas.
  4. Dashboard components, including charts, metrics, gauges, funnels, and tables, now support row-level formulas.
  5. Row-level formulas support:
  • Summaries, such as sum and average
  • Picklist fields
  • Conditional formatting
  • Report charts
  • Formatted report export
  • Report subscriptions



Filter Reports Using Field Comparisons with Field-To-Field Filters (Beta)
Filter a report by comparing the values of two different report fields. For example, see which cases were modified after the closing date by filtering on cases with a last modified date after the closed date.


Easily Read Wrapped Long Text Fields in Report Results
By default, long text fields in report results now wrap instead of truncate. With text wrapping, you can read all content in a long text field without expanding the column.


Count Unique Values in Report Results (Beta)
See how many distinct values your report returns with a unique count.




Callouts Are Excluded from Long-Running Request Limit
Every org has a limit on the number of concurrent long-running Apex requests. This limit counts all requests that run for more than 5 seconds (total execution time). However, HTTP callout processing time is no longer included when calculating the 5-second limit. We pause the timer for the callout and resume it when the callout completes.

This change applies to callouts made directly from Apex, including SOAP callouts generated by WSDL2Apex. It also applies to callouts from other platform features, such as External Services and External Objects.

Add Lightning Web Components as Custom Tabs
Make a Lightning web component available as a custom tab in a Lightning Experience app and in the Salesforce app.

Add the lightning__Tab target to the component’s configuration file. The <component>.js-meta.xml configuration file defines the metadata values for the component, including the setting to allow usage in a custom tab.

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">  
  3.   
  4.     <targets>  
  5.   
  6.         <target>lightning__Tab</target>  
  7.   
  8.     </targets>  
  9.   
  10. </LightningComponentBundle>  

New Apex Classes
These classes were introduced in this release.
Formula Class in the System Namespace
The new System.Formula class contains the recalculateFormulas method that updates (recalculates) all formula fields on the input sObjects.
FormulaRecalcFieldError Class in the System Namespace
The new System.FormulaRecalcFieldError class is the return type of the FormulaRecalcResult.getErrors method. It contains methods that retrieve the name of the error field and a message describing why the formula calculation failed.
FormulaRecalcResult Class in the System Namespace
The new System.FormulaRecalcResult class is the return type of the Formula.recalculateFormulas method. It contains methods that return the sObject with formulas recalculated and errors encountered while recalculating formulas on the sObject.

Track Setup Changes Made to Connected App Policies and Settings
The Setup Audit Trail now tracks some connected app policy and setting updates. For example, if your org has multiple admins, you can see who updated a connected app’s callback URL or access permissions.


Activate Your Flow Without Leaving Flow Builder
Activate your flow right in Flow Builder as soon as you’re done building and testing. You can also still activate and deactivate a flow version from the Flow Detail page.


Get Flexible with Email TO, CC, and BCC Fields
You can send email from Salesforce to up to 150 recipients. Previously, you could have 100 email addresses in the TO field, and 25 addresses each in the CC and BCC fields. Now you can send to 150 email addresses across the three fields in any combination, up to 4,000 characters per field.

Control Who Gets Read Access to Custom Metadata Types 
Use profiles and permission sets to assign read access to users for custom metadata types.



Know When You Have Unread Feed Items in Case Feed
Make it easier for agents to know when they have new feeds, including emails and other posts, in the case feed. The summaries of unread feed items are in bold. Previously, the summaries of both read and unread feed items were in regular font.



How to enable Topics in Salesforce Lightning Experience?

1. Edit the Lightning Record page for the object or create one.

2. Add the Topics standard lightning component.


August 18, 2019

How to pass record id from aura component to lightning web component in Salesforce?

Sample code:

Lightning component:


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

Lightning Web Component HTML:


  1. <template>  
  2.     Test - {recId}  
  3. </template>  

Lightning Web Component JavaScript:


  1. import { LightningElement,api } from 'lwc';  
  2.   
  3. export default class PrintNotesLWC extends LightningElement {  
  4.   
  5.     @api recId;  
  6.   
  7. }  

Lightning Web Component JavaScript meta.xml:


  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="PrintNotesLWC">  
  3.     <apiVersion>46.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>  

Output:




August 13, 2019

How to fetch and show all the Notes for a record using Lightning Web Component in Salesforce?

Apex Class:

  1. public with sharing class PrintNotesController {  
  2.   
  3.     @AuraEnabled( cacheable=true )    
  4.     public static List < NoteWrapper > fetchNotes( String strRecordId )  {  
  5.           
  6.         List < NoteWrapper > listNoteWrappers = new List < NoteWrapper >();  
  7.         Set < Id > setDocIds = new Set < Id >();  
  8.         for ( ContentDocumentLink objCDL : [ SELECT ContentDocumentId FROM ContentDocumentLink  WHERE LinkedEntityId =: strRecordId ] )  
  9.             setDocIds.add( objCDL.ContentDocumentId );  
  10.         for( ContentNote objNote : [ SELECT Title, Content, CreatedDate FROM ContentNote WHERE Id IN: setDocIds ORDER BY CreatedDate ] ) {  
  11.   
  12.             NoteWrapper objWrapper = new NoteWrapper();  
  13.             objWrapper.strTitle = objNote.Title;  
  14.             //Below replaceAll removes all the HTML tags from the Content  
  15.             objWrapper.strNotes = objNote.Content.toString().replaceAll( '<[^>]+>',' ' );  
  16.             objWrapper.strCreatedDate = String.valueOf( objNote.CreatedDate.date() );  
  17.             listNoteWrappers.add( objWrapper );  
  18.   
  19.         }  
  20.         return listNoteWrappers;  
  21.   
  22.     }  
  23.   
  24.     public class NoteWrapper {  
  25.   
  26.         @AuraEnabled  
  27.         public String strTitle;  
  28.         @AuraEnabled  
  29.         public String strNotes;  
  30.         @AuraEnabled  
  31.         public String strCreatedDate;  
  32.   
  33.     }  
  34.   
  35. }  

Lighting Web Component HTML:

  1. <template>  
  2.       
  3.     <div class="slds-m-around_medium">    
  4.   
  5.         <div if:true={records.data}>    
  6.   
  7.             <template for:each={records.data} for:item="rec">   
  8.                 <b key={rec.Id}>{rec.strCreatedDate} - {rec.strTitle}</b><br key={rec.Id}/>  
  9.                 {rec.strNotes}<br key={rec.Id}/><br key={rec.Id}/>  
  10.             </template>  
  11.   
  12.         </div>  
  13.   
  14.     </div>  
  15.   
  16. </template>  

Lighting Web Component JavaScript:

  1. import { LightningElement,api,wire } from 'lwc';  
  2. import fetchNotes from '@salesforce/apex/PrintNotesController.fetchNotes';  
  3.   
  4. export default class PrintNotesLWC extends LightningElement {  
  5.   
  6.     @api recId;      
  7.     @wire(fetchNotes, { strRecordId: '$recId' })    
  8.     records;   
  9.   
  10. }  

Lightning Web Component JavaScript meta.xml:

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="PrintNotesLWC">  
  3.     <apiVersion>46.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>  

Lightning Component:

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

Quick Action:

Output: