Make sure you qualify those SQL arguments in Web Services calls!

sugarcrmdevelopers —  January 11, 2013 — Leave a comment

I’ve seen questions like this time and time again, most recently on StackOverflow. Here’s the question…

I’m trying to integrate Sugar CRM with one of my projects. I’m using Apache Axis as my SOAP client.

I got the initial setup from this blog. Using this tutorial I’m able to login, fetch and insert data into my Sugar CRM installation.

I’m trying to fetch Leads using the following code

This portion is working fine, but when I try to add a query criteria as the 3rd parameter, system is throwing an error

What am I doing wrong?

This isn’t something specific to SOAP or Java, but really affects anyone using our web services who are adding a WHERE parameter. Remember that with this call, we take the contents of that WHERE parameter and put it right into the query, so it’s quite possible that the SQL parser could have trouble on knowing what table the column you are referencing is in as there are several joins that happen in this query that could conflict.

To fix, it’s quite simple. Just qualify the tablename as shown below…

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s