set_relationship returns 500 in v7.11. Is backward compatibility not supported?

My use case is simple. I'm creating a Contact, I'm creating a Case and I associate that Case with the contact. When we initially built the integration, only api v4_1 was available.

When use API Key of SugarCRM v7.11, Contact creation and Case creation are succeeding. However, when the method `set_relationship` is invoked, the SugarCRM server is returning a 500.

The same code works for v6.5

How do you suggest we alter the integration to support all versions of SugarCRM for our use case?

Parents Reply Children
  • Hi Patrick,

    Thank you for responding. But, the page you've linked to pertains to the REST API v11. We're using v4.1 and are a little hesitant to upgrade to v10-v11 at the moment since only this particular call is failing.

    So, the method we're using is set_relationship.
    Our sample request with input_type JSON is:

    {
      "session": <sessionId>,
      "module": "Contacts",
      "module_name": "Contacts",
      "module_id": <contactId>,
      "link_field_name": "cases",
      "related_ids": [
        <caseId>
      ],
      "delete": 0
    }


    PS: There are two properties above `module` and `module_name`, because without either of those I'm getting a 500.
    If both are provided, I'm getting a 200 with the following response:

    {"created":0,"failed":1,"deleted":0}

    when response_type is JSON.

    Everything seems to be working fine for SugarCRM release 6.x.
    Issue is for the latest release v7.11

  • Hi Arjun Mayilvaganan,

    The relationship between Contacts and Opportunities has a unique field value representing the Contact Role. Therefore, the set_relationship Endpoint has this as a parameter.

    Is the version of PHP the instance is hosted on 7.1.x? You can download the phpinfo() file from Admin > Diagnostic Tool in the instance to confirm this.

    SugarCRM has documented defect #80605, which states that the v41 API endpoints without all parameters will result in a 500 fatal error in instances hosted on PHP 7.1.x. The defect is viewable in the support portal for anyone with access.

    I hope this helps.