I've recently needed to make use of the SOAP api to interact with our Sugar installation. Everything was going very smoothly until I needed to set a relationship between a lead and a custom module developed using module builder. The relationship between Leads and my module was setup in the module builder and I know it works through Sugar as many of our employees have used it, the subpanels show up in the correct places, and the database table gets updated when associating a lead to my module.
However, no matter what I do, I always get a "Module Does Not Exist" error when trying to relate a lead to my custom module through the SOAP api. I threw some debugging code into soap/SoapSugarUsers.php inside handle_set_relationship() to find out which module supposedly doesn't exist. After checking that both the leads and my custom module are available in the $beanList array (and that I've spelled it correctly), I checked $mod->relationship_fields to see that the relationship exists. It doesn't. In fact, the relationship_fields array that is checked from within SoapSugarUsers.php is completely empty for my module despite having setup multiple relationships from Module Builder.
I added a special case to the handle_set_relationship for associating my module to a lead (much like the contacts/users relationship) and discovered this will cause the SOAP api to report success but it doesn't actually relate the two items since even when assigning the correct database field name to $key, the $mod->save_relationship_changes() call doesn't do anything as it doesn't seem to know anything about the relationship either.
I'm hesitant to override the save_relationship_changes call in my modules class to add this functionality since it's not very well commented in the SugarBean.php file and I can't afford to break the functionality of the module that currently works. Any thoughts or suggestions on how to fix this would be greatly appreciated.
Edit: I've also found that the SOAP get_relationships call doesn't return anything at all if I pass Leads and my module's name to it but returns the correct results/errors if you use Leads and a non-custom module. I saw nothing in the SOAP functions that would prevent these calls from working with a custom module so I can only assume it's something I did or a bug with module builder.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks