Skip to main content
added 1 character in body
Source Link
Aidan
  • 13.7k
  • 1
  • 16
  • 40

As you are discovering, the interactions between these various features isare complicated. It is far preferable / safer / easier / more likely to work to use the API to disable these relationships rather than trying to do it via SQL.

If you disable a relationship via the API and it does not handle the inherited membership then that is a bug ... but I have just tried it via API explorer and it works as expected.

$result = civicrm_api3('Relationship', 'create', array(
  'sequential' => 1,
  'id' => 49,
  'is_active' => 0,
));

If you want to do this as a script you could use the snippet above with cv

If you want to go a step further and add it as a search action then the existing 'Add relationship' actions provide a starting point.

As you are discovering, the interactions between these various features is complicated. It is far preferable / safer / easier / more likely to work to use the API to disable these relationships rather than trying to do it via SQL.

If you disable a relationship via the API and it does not handle the inherited membership then that is a bug ... but I have just tried it via API explorer and it works as expected.

$result = civicrm_api3('Relationship', 'create', array(
  'sequential' => 1,
  'id' => 49,
  'is_active' => 0,
));

If you want to do this as a script you could use the snippet above with cv

If you want to go a step further and add it as a search action then the existing 'Add relationship' actions provide a starting point.

As you are discovering, the interactions between these various features are complicated. It is far preferable / safer / easier / more likely to work to use the API to disable these relationships rather than trying to do it via SQL.

If you disable a relationship via the API and it does not handle the inherited membership then that is a bug ... but I have just tried it via API explorer and it works as expected.

$result = civicrm_api3('Relationship', 'create', array(
  'sequential' => 1,
  'id' => 49,
  'is_active' => 0,
));

If you want to do this as a script you could use the snippet above with cv

If you want to go a step further and add it as a search action then the existing 'Add relationship' actions provide a starting point.

Source Link
Aidan
  • 13.7k
  • 1
  • 16
  • 40

As you are discovering, the interactions between these various features is complicated. It is far preferable / safer / easier / more likely to work to use the API to disable these relationships rather than trying to do it via SQL.

If you disable a relationship via the API and it does not handle the inherited membership then that is a bug ... but I have just tried it via API explorer and it works as expected.

$result = civicrm_api3('Relationship', 'create', array(
  'sequential' => 1,
  'id' => 49,
  'is_active' => 0,
));

If you want to do this as a script you could use the snippet above with cv

If you want to go a step further and add it as a search action then the existing 'Add relationship' actions provide a starting point.