Posts

Showing posts from November, 2023

Customize File Downloads - Salesforce

Image
Hi Salesforce Ohana, In this article, we will discuss on how to customize file downloads in Salesforce. What are we going to cover? Scenario Blocks in the Standard/ declarative approach How to Customize File Downloads using Apex Customize File Downloads - Flow Execution Coding Time File Download Restriction Error Handling Flow Testing Time Limitations Scenario : Imagine a scenario where you/ any user(s) uploaded a file in Salesforce and restrict the downloading of the files because of various reasons like security, device factors (Block file download in mobile for Community Users), block downloads when the file already got downloaded more than 3 times, Apply IRM etc. Blocks in the Standard/ declarative approach : There is a place in Salesforce where you can control how various file types are handled during upload and download to provide more security but it is organization-level based on file types and it has many limitations. Where to find? Quick Find > File Upload and Download Sec...

Execute Apex Test Classes using Apex - Salesforce

Image
Hi Salesforce Ohana, In this article, we will discuss on 'How to execute Apex Test Class(es) using Apex in Salesforce' Before we jump into that, let's see what are the ways we generally use to run the Apex Test Classes  Run Test in the Apex Test Class in the Developer Console Test > New Run > Select the Test Classes to execute in the Developer Console Quick Find > Apex Test Execution > Select Test Classes > Run Execute the Test Classes in VS Code IDE or Code Builder Now, let's get into our thing. You can make use of the below Objects to Run/ Execute Apex Classes using Apex and extract the results of the test. ApexTestQueueItem - You can insert an ApexTestQueueItem object to place its corresponding Apex class in the Apex job queue for execution. The Apex job executes the test methods in the Apex Test Class. [ Ref ] ApexTestResult - You can query the fields of the ApexTestResult record that corresponds to a test method executed as part of an Apex class ex...