Posts

Showing posts from 2021

Salesforce Asynchronous Apex: How to work with Batch Apex Class

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community Batch Apex is a type of Apex code that is used to process large batches of data asynchronously. This means that the code is executed in the background, so it does not block the user interface or other concurrent requests.  Batch Apex is a powerful tool that can be used for a variety of tasks, such as: Data migration Data cleansing Bulk updates Archiving Scheduled jobs To use Batch Apex, you must implement the Database.Batchable interface . This interface defines three methods: start(): This method is called once, at the beginning of the batch job. It is used to initialize the batch job and retrieve the data that will be processed. execute(): This method is called for each batch of data. It is where the actual processing of the data is done. finish(): This method is called once, at the end of the batch job. It is used to

Salesforce SOAP API: How to Call Utility Functions using SOAP API

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community Running bulk insert or update jobs to add or update Salesforce Records is common practice and it is also not uncommon to see Data Synchronization Processes getting confused if the available solution is failed to update the exact time of Salesforce Record getting added or updated. To solve this common challenge Salesforce offers a function getServerTimeStamp() . This function always returns the system current date time stamp in coordination with the UTC time zone, which implies that the local system would display the result according to the local time zone settings. In this article, we see how we can query system current date-time using a SOAP API call. Prepare Request Object In this section, we will see how we can prepare the request envelope to pass it as an object to SOAP API Endpoint. Step-1: We need to pass the Session

Salesforce REST API: How to Expose Apex Classes as REST API Endpoint - POST

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community This article is in continuation of my previous article  How to Expose Apex Classes as REST Web Services - GET Operations  where I have explained how to implement a GET Operation.   In this article, we will look into the detailed implementation of exposing Apex class as REST Web Service offering a POST operation to delete records from Salesforce Object(s).    To start with the demo, I have set up some of the data in Accounts Object (Standard Object) which has Invoices Record as its Child   Step-1 & 2:  I have added an Account  “acr001”  in Accounts Object Step-3 & 4:  I have added a few  “Invoice Records”  which are associated with Customer  “acr001”   Step-5 & 6:  If we click any of the Invoice Records, we can see the respective details. We have a couple of important fields  “Invoice Number”, “Invoic

Salesforce REST API: How to Expose Apex Classes as REST API Endpoint - GET Operations

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community Salesforce allows developers to expose Apex classes and methods so that external applications can access your code and your application through the REST architecture.   Calls to Apex REST classes count against the organization's API governor limits. All standard Apex governor limits apply to Apex REST classes. For example, the maximum request or response size is  6 MB for synchronous Apex or 12 MB for asynchronous Apex . Apex REST supports the following authentication mechanisms: OAuth 2.0 Session ID   In this article, we will look into the detailed implementation of exposing Apex class as REST Web Service offering a GET operation to read data from Salesforce Object(s).   To start with the demo, I have set up some of the data in Accounts Object which we will be using to query as part of the  GET  request.   Step-1 &