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> </code>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments