Posts

Authenticating Using Salesforce Community User

Scenario - Sometimes we want to authorize servers to access data without interactively logging in each time the servers exchange information. For these cases, we can use the OAuth 2.0 JSON Web Token (JWT) bearer flow. This flow uses a certificate to sign the JWT request and doesn’t require explicit user interaction. However, this flow does require prior approval of the client app. Profiles will need to be pre-authorized with the connected app. There was also a requirement to make a rest call to get Salesforce data using Salesforce Community User Context. Option 1: Authenticate using the SOAP login request Option 2: OAuth 2.0 JWT Bearer Flow for Server-to-Server Integration

Salesforce Apex-based record sharing

Image
In Salesforce, Apex-based record sharing allows you to programmatically share records with users or groups based on specific criteria or conditions. This is useful when you need to dynamically adjust record access beyond what can be achieved through standard sharing settings or manual sharing. Create Apex Sharing Reasons Share Objects and Fields StandardObjectNameShare Example -  Let's say you want to share records with relators who belong to the "Sales" role. Here's an Apex class that uses Apex sharing to share records with users who meet the defined criteria. public class RecordSharingController {          public static void shareRecords() {         // Query records that meet the sharing criteria         List<House__c> recordsToShare = [SELECT Id FROM House__ c WHERE Status__c = 'In Market'];                  // Create a list to hold new sharing objects  ...

What is Cloud Computing?

What is Cloud Computing? Types and Examples Salesforce is a provider of cloud-based software as a service (SaaS) solutions, offering a range of cloud computing services that empower businesses to manage various aspects of their operations. Cloud computing is a way to access information and applications online instead of having to build, manage, and maintain them on your own hard drive or servers. It’s fast, efficient, and secure. It’s also a little bit mysterious. Although most of us have been using the cloud for years, the question still echoes inside of many organizations: What is cloud computing? Whether you’d like to understand it better yourself, or you’re trying to help your organization use it more effectively, this guide can help. In it, you’ll learn about: The types of cloud computing Why so many businesses are embracing cloud computing How cloud computing keeps sensitive data secure What the future of cloud computing might look like Table of Contents What is cloud computing? ...

Batch Apex vs Queueable Class in Salesforce

Image
Both Batch Apex and Queueable Apex are used for asynchronous processing in Salesforce, but they have different use cases and characteristics. Let's define each and provide an example with sample code for both: Batch Apex: Batch Apex allows you to process large data sets by breaking them into smaller batches, which are processed asynchronously in the background. Batch Apex is designed for long-running processes and can handle millions of records efficiently. Use Cases for Batch Apex: Large-scale data processing, such as data cleansing, data migration, or data aggregation. Complex calculations or transformations on a large volume of records. Integration with external systems that involve processing large data sets. Example : Suppose you have a requirement to update the status of all opportunities with a certain criteria asynchronously. You can use Batch Apex to process these records in batches. public class OpportunityBatch implements Database.Batchable<sObject> {     publ...

Auth.AuthProviderPluginClass to configure an external Salesforce authentication provider

global class B2BTIDAuthPlugin extends Auth .AuthProviderPluginClass { private String customMetadataTypeApiName; private String redirectUrl; private String consumerKey; private String consumerSecret; private String authorizationUrl; private String accessTokenUrl; private String userInfoUrl; private String scope; /** * @description This method is responsible for returning the custom metadata that           stores the api credentials and other details * @author Raja Patnaik | 01-24-2022 * @return String Returns the custom metadata type API name for a custom           OAuth-based authentication provider for single sign-on to Salesforce **/ global String getCustomMetadataType () { String methodName = 'getCustomMetadataType' ; System . debug ( 'Entered Method: ' + methodName ); customMetadataTypeApiName = ...