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 ....
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: ....
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( ....
The following sample Apex code is only for Standard Channel. I have used MessageType as 'Text'. So, it is for SMS Channel. Sample Apex Code: /** * @description Test class ....
contentType="application/vnd.ms-excel#AccountFile.xls" can be used to download the Visualforce Page in Excel Format. Sample Code: Apex Controller: public class AccountExcelFileController { public String xlsHeaderInfo { get { String strHeader = '<?xml ....
Salesforce Flow Transform Element with Apex-Defined stores the mapped data from the source data in Apex-Defined format. In the Apex Class, use @AuraEnabled annotation for the variables declaration so that ....
RestContext.response.statusCode can be used to set HTTP Status Code for Salesforce Apex REST API. Sample Apex Code: @RestResource( urlMapping='/RecordFinder/V1/*' ) global with sharing class RESTAPIController { @HttpGet global static void ....
JSONGenerator can be used if you want to order the JSON payload string. Check the following apex code for reference. It will construct and manage the JSON pay string as ....
In Salesforce SOQL, we cannot set the Offset value more than 2000. In order to overcome the Offset limitation, we can avoid using it and order the records based on ....
We cannot define the same HTTP Method multiple times in the same Apex REST Class. We get the following exception when we try to use the same HTTP Method multiple ....