Problem/Motivation

When a site builder is reliably available for a given site, the creation of custom fields is typically the best way to track additional data for Contacts, Relationships, and other CRM content (leads, opportunities, campaigns, events, cases, etc.).

However, realistically (e.g. due to limited budget), many organizations will have a developer or site builder set up their CRM once and provide minimal/infrequent support on an ongoing basis, which might not include implementing new functionality including fields.

Thus, it often falls on the end users of the CRM (who are not site builders and can't manage configuration) to maintain and categorize its data.

This must be done in the realm of content (as opposed to configuration) and thus can't involve adding fields or even configuring additional taxonomies.

A flexible, scalable, structured, user-managed tagging system could meet some of the needs of these end users.

Many CRMs offer tagging capabilities as a core offering. Drupal CRM should too.

Proposed resolution

Create an Internal field crm_relationship_statistics.

Relationships have labels for each side. These can be used to 'tag' contacts.

When a relationship is created, or when one the contact references on the relationship is changed the crm_relationship_statistics values are updated.

Remaining tasks

User interface changes

API changes

Create a Field Type for crm_relationship_statistics.

There is no Field Widget since the values are created/update in response to crm_relationship entities being created/updated.

The Field type, if possible, should be compatible with existing list formatters. hook_field_formatter_info_alter(). This may require the relationship type field column being name value.

Data model changes

Field

crm_relationship_statistics
there are two columns. The first is for the relationship type, and the second is for the current count. If someone has two children, they will have a parent and a count of two.

Relationships can be symmetrical or asymmetrical. When the relationship type is symmetrical the machine_name is stored. When the relationship type is asymmetrical the machine_name:a or machine_name:b is stored. When renderd, it should be the label of the corresponding

Entity

Add a crm_relationship_statistics field to the base crm_contact entity.
The field should be configurable for the entity view, but should not be configurable for the edit form. It should always be hidden on the edit form.

Issue fork crm-3525898

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jdleonard created an issue. See original summary.

jdleonard’s picture

Just a quick note that I'd advocate for the use of Tagify as a modern accessible solution (adopted by Drupal CMS) for handling tagging UX.

Aside: this could also be used for entity reference fields targeting Contacts and we could implement a Tagify CRM Contact List module in the same vein as Tagify User List to provide a rich experience:
Animation showing Tagify User List UX

bluegeek9’s picture

Which vocab(s) do we use?

Would Tagify be a dependency or a dev dependency?

jdleonard’s picture

IMO the most flexible and powerful tagging system would allow a site builder to manage multiple vocabularies for tagging, including to which entity types and bundles each can apply. This idea is only half-baked...

There could also be one default vocabulary (for each entity type?) for tags that don't require additional context/grouping that could support free-tagging. I'm not convinced it would be best to use Drupal's built-in concept of vocabulary (probably doesn't need to be fieldable, revisionable, or mixed in with the various non-CRM tag vocabs).

I'm also thinking of mutually exclusive labels e.g. GitLab's Scoped Labels.

Examples that a site builder might create:

  • "Lead source" vocab that applies to Contacts of type Organization
  • "VIP" term in the default vocab that applies to Contacts of type Person (note that this introduces the concept of specific terms applying to only certain entities/bundles
  • "Industry" vocab that applies to Contacts of type Organization or Person
  • "Eldest" term in the default vocab that applies to Relationships of type Household Member
  • "Past" term in the default vocab that applies to Relationships (assuming CRM doesn't provide an OOTB way to track this)
  • "No longer valid" term in the default vocab that applies to Contact Details (though I think CRM should provide a semantic field for this)
  • "Type" vocab that applies to Contacts of type Organization (e.g. "non-profit")

Probably worth some discussion whether a (non-dev) dependency like Tagify be adopted by CRM. Alternatively there could be a more opinionated, dependency-heavy "CRM Starter" kit that adds these sorts of things, leaving CRM itself very low dependency. Feels like an overall policy would be helpful so that each such thing doesn't require a bespoke debate.

bluegeek9’s picture

"Type" vocab that applies to Contacts of type Organization (e.g. "non-profit")

I think we should talk about sub-bundles/sub-types, and how they can fill the same role, and better than taxonomy terms.

"Industry" vocab that applies to Contacts of type Organization or Person

This makes sense.

"Eldest" term in the default vocab that applies to Relationships of type Household Member

I am unsure I understand this one. If it is the Eldest child in a household, should this be computed instead of a static tag?

bluegeek9’s picture

Status: Active » Postponed (maintainer needs more info)
bluegeek9’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)
jdleonard’s picture

Assigned: Unassigned » jdleonard
Status: Closed (outdated) » Active

Re-opening assigned to me so I can flesh this out.

bluegeek9’s picture

Is it possible to make the integration optional?

It is possible that site builders might not have Taxonomy installed, but I am also concerned about the automated tests. It will increase the time and complexity of the tests.

#3540527: Integration: comment

Comments seems easier to make optional as it is its own tab.

jdleonard’s picture

Yes, I think tagging could be optional. I think we should probably have a more robust discussion about criteria for what functionality is required vs. optional (ships with CRM project) vs. separate project and how recipes fit in.

bluegeek9’s picture

Status: Active » Postponed (maintainer needs more info)

Hi @JDLeonard,

Can you provide more details on what you wish to implement?

jdleonard’s picture

Title: Ability to define Tags and tag Contacts » Flexible tagging of CRM content
Assigned: jdleonard » Unassigned
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

Updated IS with my first stab at a rough proposal.

bluegeek9’s picture

Title: Flexible tagging of CRM content » Custom Field: Relationship Statistics
Issue summary: View changes
bluegeek9’s picture

Assigned: Unassigned » bluegeek9

  • bluegeek9 committed 42f64db5 on 1.0.x
    feat: #3525898 Custom Field: Relationship Statistics
    
bluegeek9’s picture

Assigned: bluegeek9 » Unassigned
Status: Active » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.
  • Review the Developer Docs for accuracy and clarity.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.