SugarCRM SOAP set_relationship

I’ve been working a lot with SugarCRM and it’s SOAP interface in the last few weeks. I’m writing a script to transfer booking that have been made on our company website to a SugarCRM instance. I’ve been reasonably impressed with the SOAP interface but it’s by no means perfect. In fact in the last two days I’ve come across a problem that makes it almost dangerous!!

We have a custom module that has two many to many relationships with the Contacts module. There is a problem however… when I call set_relationship to join the two modules together the SOAP interface is only programmed work when there is one relationships between the two. If there are two relationships… it simply selects the first one. By the first one I mean it does a SQL query on the relationships database table (which in my case returns two rows) and then uses the first row returned from the query.

The first row from a SQL query is going to be the first record that was entered into the database. If/when I do a repair and rebuild in SugarCRM (which is required when installing new modules or making certain changes) the records could get entered in a different order and as such change the relationship that the SOAP interface would use.

Personally I see this a problem. I have had to do yet another Core hack on Sugar to work around this. My next steps will be to attempt to upgrade our SugarCRM instance to a newer version and see if that makes any difference to this problem… I’m suspecting not!

2 thoughts on “SugarCRM SOAP set_relationship

    • Nope. I left it as it was. I believe the newer version of Sugar however fixes this as the entire SOAP interface has been re-written to something a lot better! In the set relationship call I think you can now pass a parameter which is the relationship you want to use.

      I am saying “think” because I’ve not worked with Sugar for sometime and have no plans at the moment to start up again. The core hack worked well through to get around the problem if you only ever want to set one relationship through the SOAP interface between two modules.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">