Replace special characters in Salesforce Apex
Regular Expression can be used in replaceAll() String method to replace all the special characters from the string in Salesforce Apex. In the following sample Apex code, I have removed ....
Regular Expression can be used in replaceAll() String method to replace all the special characters from the string in Salesforce Apex. In the following sample Apex code, I have removed ....
HTMLENDCODE() method encodes the text and merge field values for use in HTML by replacing the characters that are reserved in HTML. JSENCODE() encodes the text and merge field values ....
Exception: { "error": "invalid_request", "error_description": "must use HTTP POST" } Resolution: We get this exception when the URL is incorrect with lightning domain URL instead of the Salesforce My Domain ....
RestContext.request.requestBody contains the Request Body in Salesforce REST API Apex Class. So, we can get the RestContext.request.requestBody to handle Request Body in Salesforce REST API Apex class. Sample Apex Code: ....
In Salesforce Lightning Experience, we can use "Rich Text" standard component on the Lightning Record Page to display or show error or warning message at the record level. Enable "Display ....
SheetJS Library can be used in the Salesforce Lightning Web Component to download the record in the Excel format. 1. Go to https://cdn.sheetjs.com/. 2. Select xlsx.full.min.js from the current version. ....
Check the following sample apex code which generates random 10 characters using EncodingUtil.base64Encode(), Crypto.generateAesKey(), replaceAll() and substring() methods. Sample Apex Code: String tempKey = EncodingUtil.base64Encode( Crypto.generateAesKey(256) ); tempKey = tempKey.replaceAll( ....
Sample Apex Code: @isTest private class MessagingSessionTest { testMethod static void testMessagingSession() { User thisUser = [ SELECT Id FROM User WHERE Id = :UserInfo.getUserId() ]; System.runAs ( thisUser ) ....
updateRecord from the 'lightning/uiRecordApi' library can be used to update records without using Apex in Salesforce Lightning Web Component. Sample Lightning Web Component: HTML: <template> <lightning-card icon-name="standard:case"> <p class="slds-p-horizontal_small"> <lightning-input ....
Exception: System.FinalException: Testing already stopped Resolution: Testing already stopped exception occurs when the Test Method in Salesforce apex has two Test.stopTest() method. To resolve this issue or exception, avoid using ....