Posts

Create Salesforce bulk API job with Workbench

In this module we will learn how to create bulk API job and integrate with salesforce. Bulk API is a RESTful operation so we will use workbench to get this done [** Go : https://workbench.developerforce.com > Utilities > REST Explorer] Part I : Create  bulkAPI job and it's batch: ============================== Step 1) Create/open a job (using workbech)  ************ a. endpoint : /services/async/39.0/job b. method/call : POST c. Header : ------- Content-Type: application/json; charset=UTF-8 Accept: application/json X-SFDC-Session: <SessionID> ------- d. Body: ------- { "operation":"insert", "object":"Account", "contentType":"JSON" } ------- e. Click " Execute " Result : ------- { "apexProcessingTime":0, "apiActiveProcessingTime":0, "apiVersion":39.0, "assignmentRuleId":null, "concurrencyMode":"Para

Sorting the list rows via apex Comparable interface

For sorting the existing data we can use ORDER BY clause in SOQL query, however for non existing data we usually create ' map'  then take help from ' for' loop compare from previous values which involves lots of code consequently may bump up the apex cpu time . So to avoid this we can use Comparable interface, where we can pass the list of existing or non existing data in org, for better understanding please refer the below code, you can try in your org as well : 1. Create a global class which implement the comparable interface : -------------------------------------------------------------- global class SortingUser implements Comparable {     public Long id;     public String name;     public String phone;          // Constructor     public SortingUser(Long i, String n, String p) {         id = i;         name = n;         phone = p;     }          // Implement the compareTo() method, mendatory method it returns an Integer value that is the result

Understanding the common UNABLE TO LOCK ROW issue with bulk data job

Every time a record is inserted or updated, Salesforce must lock the target records that are selected for each lookup field; this practice ensures that, when when the data is committed to the database, its integrity is maintained. Learn how to avoid the "Unable to lock row" error while uploading large records in Salesforce. ​Below, are some sample scenarios to help you better understand the issue and how to resolve it: Sample scenario : ---------------------- Here, the "Order Detail" object is the main object on which we want to perform a DML operation and "Order__c" is the parent of "Order Detail" object. A. Process: --------------- 1. User can make an upsert/insert call on "Order Detail" object, lets take an example of upsert. 2. Wherein external ID is "Order_Detail_Id__c" B. What's happening at the back end? ------------------------------------------------ 1. When we do an Upsert call on "Order

ANT Installation for Salesforce deployments

Image
I. Download ANT Apache: ------------------ 1. Download ANT apache : click  ANT FILE , you can see ".zip archive" file link under "Current Release of Ant" section, you might get this tipe of zip file : "apache-ant-1.9.6-bin.zip" (july 2015 version), and also download Java  JDK FILE ------------------ Ant Apache : II. Installation: ------------------ 2. Copy/cut the zip file for example : "apache-ant-1.9.6-bin.zip". 3. Go to any drive, for example "D", and create 1 folder name "ANT". 4. Paste the zip file under "ANT" folder 5. Extract the zip file , by right click "Extract here" (do extract in same folder), you see 1 folder(like : "c") click the folder, you can see 4 folders and n number of files, for us "bin" and "lib" is important. ------------------ III. Integrate with Salesforce: ------------------ 6. Download salesforce migration tool : Login to s