Salesforce CRM Integration with LeadSquared

Business Challenge

  • Due to the processing of converted lead records, inbound sync was stopped.
  • In the inbound process, LSQ API was giving 5000 records in one API call. However, those many records can’t be handled by the Salesforce in a quick time frame and getting timeout error because of bulk records.
  • Internal server API error from LSQ.
  • There were some database error like required fields missing and datatype mismatching in the process of inbound sync, whole flow was stopped.
  • For logging, the system keeps the request and response of API calls. During an inbound call, faced the limit size exception to hold the response in long text area field
  • API calls should be in serial when syncing data from SF to LSQ.
  • Implementation of retry logic in case of API call failure.



  • Changed the inbound flow to process the contact records first and then Lead records. This withdrew the processing of converted Lead records.
  • Making the API call based on the records available in the LSQ by specifying the records limit of 2000 in the custom settings. Due to this, the system made a dummy call to LSQ to know how many records in the LSQ. Based on this, the system made another API call to get the records based on custom settings value.
  • Implemented the custom exception and logged the error in Audit log object that will help the admin to know the API call failure.
  • Using AllorNone DML option in the database save result that allowed the partial success of records in case of required field missing error etc.
  • Attached the response as a file to the related audit log records if limit size is exceeded
  • In case of API call failure due to internal server error or a timeout error, implemented the retry logic maximum of three times. This made the continuous data sync in case of a network error.



  • Successfully integrated Salesforce CRM application with LeadSquared.
  • The implementation included a successful data integration between the two systems using REST.
  • The integration was bi-directional sync between Salesforce and LeadSquared which enabled to map and sync various Lead fields, Contact fields, Activities between the two systems.Reduced Manual Efforts