Reset Password from Developer Console

There are instances where Reset Password option gives trouble and we do not receive the Email Link to reset the password.

Here is the best solution to directly reset the password from Developer Console itself..

Open Execute Anonymous Window and run the below command:

System.setPassword(UserInfo.getUserId(), ‘YourNewPassword’);

This should help in resetting the password instantly.

Chandra V[09-10-2019]

SoqlXplorer

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:

https://www.pocketsoap.com/osx/soqlx/

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){
        try{
            Blob bdata = Blob.valueOf(data);
            Blob encrypted = Crypto.encryptWithManagedIV('AES128', key, bdata);
            return  EncodingUtil.base64Encode(encrypted); 
        }catch(Exception e){
            system.debug('exception'+e.getMessage());
            return '';
        }
        
    }
    public static String decryptString(Blob key, String decryptString){
        try{
            Blob DecodedEncryptedBlob = EncodingUtil.base64Decode(decryptString);
            Blob decryptedB = Crypto.decryptWithManagedIV('AES128',key, DecodedEncryptedBlob);
            return decryptedB.toString();   
        }catch(Exception e){
            system.debug('exception'+e.getMessage());
            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);
        system.debug(guid);
        return guid;
    }

Sumanth A [03/08/2019]

Steps to Enable Event Monitoring dashboards in PROD/Sandbox

Hello!!

I am going to produce the steps to Enable Event Monitoring dashboards in Salesforce Sandbox /Production Environment….

Pre-Requisite: >> Enable Analytics >> Setup >> Analytics >> enable Analytics (This is a major step without this you won’t see analytics studio app)

  1. Setup >> Event Monitoring >> Enable Login Forensics and Event Log File Integration with Event Monitoring Analytics App
  • Open Analytics studio app >> Click on that and a new tab will open (FYI., pop up from browser might block this so set it to allow)
  • Create >> Click on it
  • Follow the below screen steps
  • You will see steps 1 to 5 don’t change anything except the no. of days to 30
  • Name the App “Event Monitoring App”
  • The app will run and you will see the below screenshot and an email will be sent once its ready.

Hope you got all the details!

Anil B [03/03/2019]

Email Quick Action missing in Feed Tab

In this post, I am going to provide you with the steps to debug the issue: Email Quick Action missing in the feed Tab…

  1. Login to salesforce Sandbox (www.test.salesforce.com) or Production org
  2. Navigate to the app (ex. Service console) using app launcher
  3. Open Case page and check if the quick action is visible
  4. Follow the below steps only if quick action is not visible
  5. Setup>>Object Manager>>Case object>>Case Page Layouts>>check if the quick action is added to the case page layout
  6. Drag and Drop the quick action into the layout and click save
  7. Even now if the quick action is not visible now then please follow the below steps
  8. Setup>>Administer>>Email Administration>>Deliverability>>Set Access to Send Email (All Email Services) to All Email>>Click Save.
  9. FYI., Screenshot for reference

Anil B[03/03/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 https://test.salesforce.com

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  test@example.com(user name of the Sandbox)

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

https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components

-Ranjith T [02/25/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” >
<!– HANDLERS –>
<aura:handler name=”init” action=”{!c.doInit}” value=”{!this}” />
<!– ATTRIBUTES –>
<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” />
<br/>
</div>
</div>

<lightning:datatable data=”{!v.componentHistory}”
columns=”{!v.headers}”
keyField=”Id”
hideCheckboxColumn=”true”
onsort=”{!c.updateColumnSorting}”
sortedBy=”{!v.sortedBy}”
sortedDirection=”{!v.sortedDirection}”/>
</div>
</aura:component>

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]