Invoking SOAP API to get Relations and create relations.

Hello everyone,

We are using the SOAP API to get and create records from an external system and create the relations between module records.
We were using SoapUI to verify the behavior of the invocations to the API and we came aware with one situation where we are not seeing what we expected to see when invoking the get_entry.

  1. invoking get_entry
    We are invoking this to retrieve an account information and its relationships. The account exists in the application and has a related case.
    When we invoke the service with the payload we attached, the field information is returned but the relationship isnot returned as expected in the relationshipt_list.
    Is there some input we are not passing correctly to achieve this?

Request get_entry:
<soapenv:Envelope xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:sug=“http://www.sugarcrm.com/sugarcrm” xmlns:soapenc=“http://schemas.xmlsoap.org/soap/encoding/”>
soapenv:Header/
soapenv:Body
<sug:get_entry soapenv:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
dffmd456l76daqfpehdjo7cae1
<module_name xsi:type=“xsd:string”>Accounts</module_name>
cf0486c8-1d98-7320-41f5-59f31323e03e
<select_fields xsi:type=“sug:select_fields” soapenc:arrayType=“xsd:string[]”/>
<link_name_to_fields_array xsi:type=“sug:link_names_to_fields_array” soapenc:arrayType=“sug:link_name_to_fields_array[]”>
<link_name_to_fields xsi:type=“sug:link_name_to_fields”>
account_cases

id

</link_name_to_fields>
<link_name_to_fields xsi:type=“sug:link_name_to_fields”>
accounts_contacts

id

</link_name_to_fields>
</link_name_to_fields_array>
<track_view xsi:type=“xsd:boolean”></track_view>
</sug:get_entry>
</soapenv:Body>
</soapenv:Envelope>

Thanks for you help in advance.
Regards.

Everything you need … is here :
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Method_Calls/

and

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Method_Calls/set_relationship/
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Method_Calls/set_relationships/

Hello,

Thank you for your reply.
I already saw the documentation and was able to create relationships.
My main doubt, as stated in the previous post, is that when I try to use the API get_entry to obtain the information for an account, although the account as relations, this are not returned with the get_entry method.

So my question persists, shouldn’t the get_entry return the relationships and if so do I require to had something to the request to obtain the relationships information?

Thank you.
Regards.

Hi,
from documentation you can see that you can use “link_name_to_fields_array” to return a list of couple name-value related to the record, but you can not to obtain the relationships information.
To do that you can extend the service method get_entry or write your own method or you can use “get_relationships”

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Method_Calls/get_relationships/

1 Like