We created a REST Service in Salesforce in our previous blog, and now we want to call the REST service from another application. Salesforce DO NOT allow using Basic Authentication (Username & Password) for incoming REST calls. This is still true even if you are calling from another Salesforce instance. We have to use OAuth to authenticate…
Tag: APEX
How to create and use Apex Rest Services in Salesforce ?
The Force.com REST API lets you integrate external system with Force.com applications using simple HTTP methods, in either XML or JSON formats, making this an ideal API for developing mobile applications or third party applications. Following are the benefits of using the REST API in your integrations: Easy Access: Use standard HTTP method call-outs, available on…
How to write test class for Batch Apex in Salesforce ?
We should always test batch class with good amount of data (minimum 200 records) in our test class. Here is the example of batch apex testing. In below code, we are updating name of all accounts with “Updated” keyword in the last of account name. Batch Class: global class AccountUpdate implements Database.Batchable { global Database.QueryLocator…
How to Disable or Delete an Apex Trigger or Class from Production Organization ?
Apex code can’t be modified directly within a Production organization, so it requires steps using Developer tools, like the Force.com IDE. Steps to Remove or Disable Apex Classes/Triggers 1. Force.com IDE should be installed. 2. Connect to the Production Instance using the IDE and find the class or trigger that you want to delete. 3. Open…
What is the purpose of @future method in Salesforce? How can we implement @future method?
In Salesforce usually we write a trigger for an object, and then from the trigger we call a method on a class. If we need to make call out to an external web service from the trigger we get “System.CalloutException: Callout from triggers are currently not supported”. @future method with callout=true is the way to…
How to implement dynamic bar charts using Visualforce Charting ?
Visualforce charting help developers to implement customized business charts based on the data sets created directly from SOQL queries, or by building the data set in Apex code. We can use any chart provided by Salesforce like bar, line, area, and pie charts commonly used in business graphics, as well as radar, gauge, and scatter charts for more specialized charting….
What is JavaScript Remoting in Salesforce?
JavaScript remoting (Js Remoting) is a way to call methods in Apex Classes directly from JavaScript. It allows you to perform tasks on the page without having to reload the entire page. There are several benifits for using Js remoting for apex controllers:- Java Script remoting does not store view state, and thus helps to minimize…
How do we write a Batch Class in APEX and schedule it to run?
Scenario We need to look at all Accounts and update the related Contacts description with Rating field from respective Account. e.g. “Account rating is Cold” Why Batch Apex ? Batch Apex is used to process high volume of records and it allows us to run their code on a specific time. In batch APEX there is the…
How to write APEX Triggers and What are the best practices?
Apex triggers allows you to perform some actions when any record is created, updated, deleted or undeleted in Salesforce. What can we do using triggers? A trigger can perform following actions: Insert, Update, Delete records. Update fields from child to parent and vice-versa. Send Emails to record owner, external user, contact & lead etc. Call…
How can we handle Approval Process using APEX?
Approval process is an automated process which is used to submit, approve and reject records in Salesforce. It specifies the steps necessary for a record to be approved and who must approve it at each step. We can configure approval process from Salesforce, and then use APEX to submit, approve or reject the record. Automatic Submission of Record for Approval…