How to find day of the week using Salesforce Apex?
formatGMT( 'EEEE' ) can be used to return the week using Salesforce Apex. Sample Code: String strDate = '2022-12-16'; Date dateValue = Date.valueOf( strDate ); System.debug( 'dateValue is ' + ....
formatGMT( 'EEEE' ) can be used to return the week using Salesforce Apex. Sample Code: String strDate = '2022-12-16'; Date dateValue = Date.valueOf( strDate ); System.debug( 'dateValue is ' + ....
Database.insertImmediate() method can be used to create External Object record synchronously using Apex. Sample Code: Test__x objTest = new Test__x(); objTest.PK__c = '3'; objTest.SK__c = 'Test3'; objTest.Name__c = 'Test3'; Database.SaveResult ....
Time difference between Case Creation Date and Email Message MessageDate can be used to find time delay in Case creation from Salesforce Email-To-Case. Sample Code: for ( EmailMessage objEM : ....
To generate PDF file from String Content using Salesforce Apex, use toPdf(). Check the following sample code for reference. Sample Code: Blob blobContent = Blob.toPdf( 'Testing File' ); ContentVersion objCV ....
EncodingUtil.base64Decode() can be used to convert Base64 content to Blob value. Then, we can use toString() to convert the Blob value to String. Sample Code: String base64Content = EncodingUtil.Base64Encode( Blob.valueOf( ....
We can make use ContentVersion entity to create files using Salesforce Apex. Use ContentDocumentLink entity to link the created the file to a record in Salesforce. Sample Code: String base64Content ....
To find whether Salesforce instance is Up and Active using API, then use https://api.status.salesforce.com endpoint. Remote Site Settings: Sample Apex Code: String endpoint = 'https://api.status.salesforce.com/v1/instances/NA100/status'; HTTP h = new HTTP(); ....
Exception: System.EmailException: SendEmail failed. First exception on row 0; first error: NO_SINGLE_MAIL_PERMISSION, Single email is not enabled for your organization or profile.: [] Exception or Error This exception is thrown when ....
Sample Flow: accountId Input Variable: accountName Output Variable: Sample Code: Map < String, Object > flowParams = new Map < String, Object >(); flowParams.put( 'accountId', '0013t00002XXRyDAAX' ); Flow.Interview.Account_Auto_Launched_Flow myFlow = ....
To query Salesforce Picklist Field values using SOQL, use PicklistValueInfo object/entity. Sample Code: EntityDefinition objED = [ SELECT Id, DurableId FROM EntityDefinition WHERE DeveloperName = 'Account' ]; FieldDefinition objFD = ....