ColdFusion and SugarCRM Intergration

If you would like to integrate your ColdFusion site with SugarCRM, please see the new ColdSugar project at RIAForge. This is a simple CFC that allows for complete integration with a SugarCRM account. You can get any kind of data and perform updates as well. I wish I could say there was something sexy about this code, but their API was relatively simple to work with.

Some sample code:

<cfset coldsugar = createObject("component", "sugarcrm").init("http://eval.sugarondemand.com/xxx/soap.php?wsdl", "admin", "foo", true)>

<cfdump var="#coldsugar.getList('Opportunities')#" label="Opportunities">

<cfset q = "opportunities.name LIKE 'TI%'"> <cfdump var="#coldsugar.getList(type='Opportunities',query=q)#" label="query=#q#">

<cfdump var="#coldsugar.getList(type='Opportunities',orderby='amount_usdollar')#" label="sort by amount_usdollar">

<cfdump var="#coldsugar.getList(type='Opportunities',deleted=true)#" label="deleted">

<cfdump var="#coldsugar.getList(type='Opportunities',fields='name,amount_usdollar')#" label="Just name and amount_usdollar">

<cfdump var="#coldsugar.getList('Contacts')#" label="Contacts">

<cfdump var="#coldsugar.getList('Accounts')#" label="Accounts">

<cfdump var="#coldsugar.getList('Documents')#" label="Documents">

<cfdump var="#coldsugar.getList('Calls')#" label="Calls">

<cfdump var="#coldsugar.getList('Meetings')#" label="Meetings">

<cfdump var="#coldsugar.getList('Tasks')#" label="Tasks">

<cfdump var="#coldsugar.getList('Notes')#" label="Notes">

<cfdump var="#coldsugar.getFields('Emails')#" label="Email Fields">

<cfset emails = coldsugar.getList('Emails')> <cfdump var="#emails#" label="Emails">

<cfset email = coldsugar.get('Emails', emails.id[1])> <cfdump var="#email#" label="Emails">

<cfset email.status = 'replied'> <cfset r = coldsugar.save('Emails',email)> <p> Result of save is #r# </p>

<cfset coldsugar.logout()>

<p> Done with tests. </p> </cfoutput>

Archived Comments

Comment 1 by Pat Buchanan posted on 2/9/2009 at 1:33 AM

RAY! Holy cow how do you read my mind all the time. I was just thinking this weekend how nice it would be if I could find something like this. Our company REALLY needs something like SugarCRM but I was hesitant because it's not ColdFusion based, and I DON'T want to learn yet another language (5 is enough for now, and I HATE PHP). However, this app looks like it is WELL thought out, and your wrapper should come in handy. Thank you so much for always sharing!!!!

Comment 2 by Amy Tackett posted on 6/2/2010 at 1:38 AM

The web service call for the login method will not work (I am using the hosted version of Sugar, v 5.5.2). It doesn't like the parameters that are being passed, even though they appear to line up. I am guessing that there have been updates to the Sugar API since ColdSugar was written that are causing this breakdown, but I can't seem to figure out how to get the variables to line up properly. If anyone has any insight, I'd appreciate it greatly!

Comment 3 by Raymond Camden posted on 6/2/2010 at 6:24 AM

Shoot - well, unfortunately, I don't think I'll have time to update it. It was kind of a pain to get a demo account with them if I remember right.

Comment 4 by Amy Tackett posted on 6/2/2010 at 8:13 PM

Okay, I understand. I'll try to post the resolution here when I find it!