SugarCRM has a REST API, and Craft boasts its ability to integrate with almost anything that has an API; however, I am working on a site that uses Sprout Forms, which doesn't mention anything in their docs about integration.

Is there a way, in addition to emails and saved entries, for Craft to push Sprout Form data to SugarCRM?

If this isn't possible, if there another contact form solution that will integrate this way?


I was able to accomplish this by grabbing Craft Business Logic, stripping out most of the examples, and simply listening for a form submission:

craft()->on('sproutForms.onSaveEntry', function (Event $event)
    $entry = $event->params['entry'];
    $content = $entry->getContent()->getAttributes();

    // Let's not pass fields we don't need
    $fields = array();
    $ignore = array('id', 'slug', 'title', 'handle', 'locale', 'element', 'elementId');

    foreach ($content as $field => $value)
        if(!in_array($field, $ignore))
            $fields[$field] = $value;

    $fields = http_build_query($fields);
    $ch = curl_init('https://url-to-sugar.crm/index.php?entryPoint=WebToLeadCapture');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

    $response = curl_exec($ch);

I just created an init function in the plugin and added this there. I didn't need to use an API because the data is only flowing in one direction. I just used curl to push the data.


At the time of this posting, I don't know of any out of the box SugarCRM integration with Craft.

While Craft is quite capable of integrating with almost anything, the intro section in their docs also states that it's a CMS for people who build custom websites. There are millions of potential products with REST APIs and millions of different needs in how companies need to interface with those APIs. Any specific integration will likely require some additional effort to make happen. Craft's ability to integrate with anything comes via the power and flexibility they give developers to extend the CMS for custom scenarios.

Sprout Forms also provides several ways that it can be adapted to custom scenarios and extended to interface with other services. Each service is different and I am not familiar with SugarCRM so your mileage may vary, but here are some of the tools Sprout Forms makes available to you to customize how Forms are submitted:

  • Template Overrides allow you to customize how your base Sprout Forms templates are formatted. In the case the endpoint you are submitting to has a particular format that fields names need to comply with, you can adjust that here.
  • Payload Forwarding allows you to submit your form to a third-party URL instead of to Craft. In the settings area you can choose whether your data is saved to Craft or whether you want to trigger emails from Craft or if you just want to offload everything and send your form submission to a third party.
  • Sprout Fields integrates with Sprout Forms and provides a Hidden and Invisible Field if you want to include things like API Keys in your request but not have them presented to the user in the form.

While a lot can be done with the above integration options, each situation is different and we've also run into scenarios where we needed to create a small plugin to help handle and hand off the data between Sprout Forms and another system. We have plans to improve the flexibility of these types of integrations even more as we get upgraded to Craft 3.

Unless there is a large need for a specific integration (like SugarCRM), it's likely that you won't find a specific plugin addressing the issue and that you'll be at some level custom development territory. If you do see integrations for specific platforms, it's also worth asking: how likely is it that the developer who created this plugin has enough clients using it that they will actually update the plugin in the future?

In my experience, specific integrations often require project-specific budgets and are best handled in direct client relationships and it's important to communicate with clients and help them understand that these types of integrations may also require additional maintenance and update costs down the road that are specific to their needs.

We often help clients with small projects where someone needs to extend Craft or a plugin to integrate with a new third-party system and while our plugins support some integrations publicly, they support a lot more integrations privately as those private integrations often solve a specific client's needs and we need to be clear with those client's using them that they will only receive updates if someone can cover the development costs to maintain them.

  • Thanks, I am getting somewhere but I want to be able to push data to both Craft and offsite, if possible. You mentioned that if the endpoint required a field format, I can adjust it with templates. However, I noticed that when I set my field names, e.g. 'first_name', the actual name it gets is 'fields[first_name]'. If I use an override to take out the fields[] part, the form no longer submits to the cms.
    – 3x5
    Feb 19 '18 at 21:50
  • Sometimes different data formats are needed to submit data to multiple systems and, right now, Sprout Forms can only send that data in a single format. We'll be reviewing this once we get upgraded to Craft 3. For now, you could keep the Craft-friendly format with your form submission and submit the data to a custom plugin endpoint that modifies and forwards the data to your other endpoint. Right now this situation will likely require the help of another custom helper plugin to modify or remap the data at the right time. Feb 20 '18 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.