Monthly Archives: September 2014

Salesforce Integration with external Systems

In Salesforce for integrations before deciding on any approach ask yourself following questions so that you can make a better decision about an approach.

A. What is expectation of response. Is it instantaneous or can user wait? If user can wait then what is the threshold value for which user will wait?
Why: 1. If the response is returned in the same call then its very good, but if is giving request identifier then for fetching results you will need Schedulable batch option which can make callout and get the results for you. Always remember that this will delay the completion of whole cycle by min 2 mins to 15 min depending upon how sales force executes batch.
2. There is very hard limit of 10 callouts in a transaction so consider this before doing any architecture.

A. Generating XML by String concatenating?
1. Try to divide XML generation by dividing whole logic in methods.
2. Have one method for every kind of XML generation which cleans up the value based on type. Eg. Applying appropriate date format, handling null values. This gets varied based on the system with which you are integrating. So it gives you the ability to keep formatting things at common place.

B. What is the expected time of the response?
There is a limit of 120 seconds limit for overall call out time in a transaction and cap of 60 seconds for a single callout.

C. Are you sending any DB generated data in integration?
If you are sending any DB generated data like autonumber, then you need break transaction, since sales force does not allow any dml before the call out. Normally changing transaction means normally doing ajax call after the DML making transaction is done.

D. Do you need to store information received after making callout and handling network failure or system error?
So basically you are doing a DML after call out which is allowed, but just think what if the dml fails and you rolled back everything. But my friend you can not rollback the call out you had done, so have planning for such scenario like submitting the data again and asking the other end system to ignore the first call. This save lot of efforts and panic when system goes live.

If you have any integration related question please comment below. Happy learning!!