Here, I would like to tell you about a new tool I have been using these days for enhanced querying through all the objects in the environment.

Steps to use this tool and make your querying quick through any field and condition.

Link to download the tool:

Step 1:

Login into the Sandbox that you would like to query on objects

After logging in, To the left hand side we can see all the objects. Need to double click on the object we want and we can see all the fields present in the object.

As per our requirement, we should enhance the query and add the conditions to get the results on the fields by clicking on query at the bottom.

Hope this tool helps in improving the querying time and checking the values on the fields.

-Chandra [07/28/2019]

Apex Crypto And Decrypto Class

public class EncryptAndDecryptHelper {
    public static String encriptString(Blob key, String data){
            Blob bdata = Blob.valueOf(data);
            Blob encrypted = Crypto.encryptWithManagedIV('AES128', key, bdata);
            return  EncodingUtil.base64Encode(encrypted); 
        }catch(Exception e){
            return '';
    public static String decryptString(Blob key, String decryptString){
            Blob DecodedEncryptedBlob = EncodingUtil.base64Decode(decryptString);
            Blob decryptedB = Crypto.decryptWithManagedIV('AES128',key, DecodedEncryptedBlob);
            return decryptedB.toString();   
        }catch(Exception e){
            return '';

Ranjith T [03/09/2019]

Algorithm to generate the unique id in salesforce using Apex

There might be scenarios where we as a developer needs to generate random unique ID’s to be used for external integrations in Apex.

Here is a simple method which generates the unique code everytime.

public static String getUUID()
        Blob b = Crypto.GenerateAESKey(128);
        String h = EncodingUtil.ConvertTohex(b);
        String guid = h.SubString(0,8)+ '-' + h.SubString(8,12) + '-' + h.SubString(12,16) + '-' + h.SubString(16,20) + '-' + h.substring(20);
        return guid;

Sumanth A [03/08/2019]

Connecting Sandbox (Dev) to Visual Studio code For Developing Lightning Web Components(LWC)

Here, I am going to present you the steps to connect the Sandbox to Visual Studio Code for connecting the Lightning web Component…

First step: Install Salesforce Extensions for Visual Studio Code

screenshot for Extensions in VS Code
Lightning Web Components Extension

Login in to Sandbox and Use the below command in the Terminal

sfdx force:auth:web:login –setalias my-hub-org –instanceurl

After logging in…

  1. Use ctrl+shift+p
  2. Enter Sfdx:create Project
  3. Select the Source where you want to create Project.

To Create Lightning web Component use the Below Command in Terminal

sfdx force:lightning:component:create –type lwc -n myComponent -d force-app/main/default/lwc

AND Finally to deploy use the command below:

sfdx force:source:deploy -p force-app -u name of the Sandbox)

Also, Follow the Link below for better experience on Lightning Web Component:

-Ranjith T [02/25/2019]

Validation Rule Requiring Lead Fields Prior to Conversion

In this post I am writing a validation rule that requires all of these fields prior to Lead conversion.

Need is a checkbox, Languages and propsepct role are picklists, Notes and SDR are text…

Below is the successful Formula that works for the above criteria:

Also, If the  Notes__c a Rich Text area field, then you need to use this:


If the above don’t work either, then check the following:
This Lead Settings should be checked in order for the Validation Rule to Fire.
Hope this information helps you!
– Chandra V [01/12/2019]


Field History Tracking on Custom Components

There is a limitation on the Field Tracking on the Quote Standard object in Salesforce.

This functionality is used when a custom application is built and want to track the history of the fields that are created
on the component.

In this scenario, I am tracking the Field History based on these criteria:

Date / Field / Original value / New Value / Type / Modified By

In the below scenario, Tracking the Custom Component Fields Based on two objects – Quote and Quote Line Item.

Lightning Component for Field History Tracking:

<aura:component controller=”QuoteAndQuoteLineItemHistory” implements=”force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction” access=”global” >
<aura:handler name=”init” action=”{!c.doInit}” value=”{!this}” />
<aura:attribute name=”componentHistory” type=”List” />
<aura:attribute name=”componentHistoryFinalList” type=”List” />
<aura:attribute name=”searchText” type=”String”/>
<aura:attribute name=”headers” type=”List”/>
<aura:attribute type=”Boolean” name=”sortType” />

<aura:attribute name=”recordId” type=”Id” />
<aura:attribute name=”sortedBy” type=”String” default=”Name”/>
<aura:attribute name=”sortedDirection” type=”String” default=”asc”/>
<div class=”slds”>
<div class=”slds-grid slds-gutters”>
<div class=”slds-col slds-size_9-of-12″></div>
<div class=”slds-col slds-size_3-of-12″>
<lightning:input type=”text” name=”searchInput” onkeyup=”{!c.filterSelection}” value=”{!v.searchText}” aura:id=”searchInput” label=”Type here to search” />

<lightning:datatable data=”{!v.componentHistory}”

This component also has the functionality of Sorting and Search feature.

Please comment and reach out for the Apex Class and related java scripts.

Chandra V [11/3/2018]

How to use Named credentials for Callouts (Integrations)

In the call outs or Integrations that we do from Salesforce to External Systems, we should pass the Endpoint URL and Password in the Header to hit the External System.

Using the Named Credentials we can Put these Endpoint URL and Password in a Label and can expose that label in the code.

Below are the Steps for Navigating to Named credentials:

Setup -> Type Named Credentials -> Setup the Named Credentials with all the details


This is considered as one of the best practices (Not exposing the URL and Password in the code)

Sumanth A [10/25/18]

Check for Empty strings in Java Script

Below is the code for checking the Empty Strings present in the Java Script

string str;

if(str != ‘undefined’ && str != null && str != ” && str != undefined && str != ‘null’ && str != ‘ ‘ && str.trim() != ”)
// if string is not empty do your logic

else // if string is empty
do your logic

Using this we can check the empty strings in JavaScript.

Sumanth A [10/25/18]

Notes and Attachments in Salesforce Lightning

Users may have noticed that Files under the Notes & Attachments related list don’t show up on the Account record when a user switches to Lightning Experience, however the same files are available when you switch back to Salesforce Classic.

Similarly, the same behavior can be observed when converting leads with attachments:

1. Create a Lead
2. Add a attachment to the lead [Newly added attachment shows up under the Notes & Attachments related list in Salesforce Classic]
3. Now convert the lead by creating a new account ‘or’ Add to an existing account
4. Open the newly created account in Salesforce Classic and you will see the attachment record created in Step 2
5. Switch over to Lightning Experience and navigate to the account, you will not see the attachment under the Notes & Attachment related list.

Note: Upload a File under the Notes & Attachments for a Lead record in Lightning Experience. When a lead is converted, the file will not get transferred to contact/account. The attachment in lightning experience is an action to upload a “File”. At the moment, Files don’t support the roll-up during lead conversion. Thus, the “Files” are not visible in contact/account.

 Apex Class :

public class AccountAttachmentsController {

public static map<string,list<sObject>> getAllRelatedAttachments(string accountID){
set<id> parentIDs=new set<id>();
map<string,list<sObject>> mpAttachment=new map<string,list<sObject>>();

Account objAccount=[select id,(select id from contacts),(select id from Orders),(select id from Cases),(select id from ActivityHistories ORDER BY ActivityDate DESC , LastModifiedDate DESC LIMIT 500),(select id from OpenActivities ORDER BY ActivityDate ASC , LastModifiedDate DESC LIMIT 500),(select id from Opportunities)
,(select id from Deliveries__r),(select id from Invoices__r)
from Account where id=:accountID];


for(contact objContact: objAccount.contacts){

for(Case objCase: objAccount.Cases){

for(Order objOrder: objAccount.Orders){

for(Opportunity objOpportunity: objAccount.Opportunities){

for(ActivityHistory objTask: objAccount.ActivityHistories){


for(OpenActivity objTask: objAccount.OpenActivities){


for(Deliveries__c objDelivery: objAccount.Deliveries__r){

for(Invoice__c objInvoice: objAccount.Invoices__r){



mpAttachment.put(‘Attachment’,new list<attachment>([select id,Name,Body,BodyLength,ContentType,Description,
LastModifiedById,LastModifiedBy.Name,CreatedById,CreatedBy.Name from attachment where ParentId in:parentIDs ORDER BY LastModifiedDate DESC]));
mpAttachment.put(‘File’,new list<ContentDocumentLink>([SELECT ContentDocumentId,LinkedEntityId,LinkedEntity.Name,ContentDocument.ContentAssetId,
ContentDocument.LastModifiedById,ContentDocument.CreatedById,ContentDocument.CreatedBy.Name FROM ContentDocumentLink WHERE LinkedEntityId in :parentIDs ORDER BY ContentDocument.LastModifiedDate DESC]));


}catch(Exception ex){
throw new AuraHandledException(‘Error occurred: ‘ + ex.getMessage());
return mpAttachment;

In my case, we have attachments that are related to child objects(Contacts, Cases, Orders, Opportunities, Activity History, Open Activities, Invoices, Deliveries). If you just want attachments that are related to any specific child object you can just query the same.

Helper Class :

getAllAttachments : function(component,event,helper) {
var action = component.get(“c.getAllRelatedAttachments”);
“accountID” : component.get(“v.recordId”)
action.setCallback(this, function(response) {
var state = response.getState();
if(state === “SUCCESS”){
let returnList=[];
let allAttachmentes=response.getReturnValue();
if(allAttachmentes!=undefined && allAttachmentes.length!=0){
for(let i=0;i<allAttachmentes[‘Attachment’].length;i++){
“formatedDate”:this.formatDate(new Date(allAttachmentes[‘Attachment’][i][“LastModifiedDate”].substring(0,10)))
if(allAttachmentes[‘File’]!=undefined && allAttachmentes[‘File’].length!=0){
for(let i=0;i<allAttachmentes[‘File’].length;i++){
“formatedDate”:this.formatDate(new Date(allAttachmentes[‘File’][i][“ContentDocument”].LastModifiedDate.substring(0,10)))
}else if (state === “ERROR”) {
var errors = response.getError();
if (errors) {
if (errors[0] && errors[0].message) {
“title”: “ERROR”,
“message”: “Error message: ” + errors[0].message,
“type”: “error”
} else {

“title”: “ERROR”,
“message”: “Unknown error”,
“type”: “error”

Note : Hope this should really solve the issue. If not, please get in touch with me:

–  Yeshas Konduru [10/11/18]