CiviCRM Cookbook
上QQ阅读APP看书,第一时间看更新

Adding a time-limited relationship

Relationships are a central feature of CiviCRM. For example, you may run an organization that has contacts related to it because they are volunteers, or you may have individual contacts that are the children of other contacts who are their parents. Some relationships are time-limited. For example, the chair of an organization may have a one year fixed term of office.

How to do it…

In this recipe we will set up a time-limited relationship between two contacts using the following steps:

  1. Navigate to Administer | Customize Data and Screens | Relationship Types and click on Add relationship:
  2. Set Relationship Label-A to B to Chair.
  3. Set Relationship Label-B to A to Chair is.
  4. Set Contact Type A to Individual.
  5. Set Contact Type B to Organization.
  6. Set a suitable description in the Description field.
  7. Check if the relationship is enabled.
  8. Save the relationship.
  9. Navigate to an individual contact, click on the Relationship tab, and add the relationship.
  10. Select the relationship type Chair and select the contact to relate to. CiviCRM autocompletes your entry from the organizations available in the database.
  11. Enter a start date and an end date for the relationship and add a description.
  12. Navigate to Administer | System Settings | Scheduled Jobs and enable and set the Disable Expired Relationships job.

How it works…

Contact Type A is set to Individual. Contact Type B is set to Organization. This means that only individuals can be chairs of organizations.

The Disable Expired Relationship job checks the dates on relationships and disables them if they have expired. This requires cron in order to function properly.

There's more…

You can allow the two related contacts to be able to view and edit each other's records by using the checkboxes below the Notes field. For example, you could allow the chair to be able to edit the organization record. This would also require the individual contact to have an active account on your CMS and permission to access their CiviCRM contact dashboard.

Note

Relationships become available for use in CiviCRM core functions such as importing, exporting, and searching data. They are also used in creating membership types.

See also