+ Start a Discussion
Prad NethasPrad Nethas 

Integration Technics

Hi Techies,

Hope evry one doing good. I am new to Salesforce Integraiton. Can some body help me/guide me how to start with. 
What are the best practises to learn salesforce integration. Requesting you all to give me your valuable suggestions to learn salesforce integration easily, also share your examples on salesforce integration.

Thanks in advance fellows.

Great day ahead.
Himanshu ParasharHimanshu Parashar
Hi Prad,

It would be great if you can put your requirements in details. When we talk about the integration there are n number of methods available and it all depends what technology you are going to use for that.

Here are the basic question which you need to ask yourself and post your answer here.

1. What type of integration you are looking for ?
2. Will it be inbound integration or outbound integration ?
3. If it is outbound integration what technology you are using for external system.PHP, .NET, JAVA ?
4. What will be the integration business process ?

Prad NethasPrad Nethas
Hi Himanshu,

I am looking for SOAP/REST type integration examples
Both inbound and outbound
RIght now I am looking for JAVA, PHP,

Actually I am looking for integration examples or samples to learn.

Can you please share them once if you have.

Jason Sun 11Jason Sun 11
There are few ways to approach this if you are doing a RESTful integration and need to send a JSON payload to an external service. Sometimes, you want to go the custom code route, and the general approach you can use is there to create a wrapper class for the request like the following:
public class SomeJSONrequestWrapper { public string record_id { get; set; } }

And then use JSON Class serialize method (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_Json.htm#apex_System_Json_serialize) to create your JSON payload.
The JSON.serialize method will convert the data in your wrapper class to the corresponding JSON format.

You can also do something similar for the response except you'll deserialize (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_Json.htm#apex_System_Json_deserialize) the response into your response wrapper.  You need to make sure that your wrapper class match the JSON structures very closely.  Then you'll end up with a Salesforce object that's been deserialized from the JSON structure.  Once it's an object, then you can work with it in Salesforce APEX code.

You'll also have to make some type of HTTP request like the following example for a POST request:
Http h = new Http(); 
HttpRequest req = new HttpRequest(); req.setHeader('Accept', 'application/json'); 
req.setHeader('Content-Type', 'application/json'); 
HttpResponse res; res = h.send(req);

Typically, you will call your API/webhook methods asynchronously within an future method called from an Apex trigger or from batch context.

There are also some AppExchange apps which can make this way easier and don't require any code like Declarative Webhooks (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3u00000MSv8REAT).