1. Introduction

GR8 CRM is a set of Grails Web Application Framework plugins that makes it easy to develop web applications with CRM functionality.

You can find more information about GR8 CRM on the main documentation site http://gr8crm.github.io.

1.1. Customer relationship management

Customer relationship management (CRM) is a system for managing a company’s interactions with current and future customers. It involves using technology to organize, automate and synchronize sales, marketing, customer service, and technical support. Wikipedia

The GR8 CRM "Ecosystem" currently contains over 40 Grails plugins. For a complete list of plugins see http://gr8crm.github.io.

2. CRM Tags Plugin

The crm-tags plugin provides both storage, service and user interface components for working with tags.

2.1. Enable tagging support for a domain class

To make a domain class "taggable" you add a static property taggable on the class.

class Person {
  String name

  static taggable = true
}

3. Services

The crm-tags plugin provides a service that you can use to interact with tags and tagged entities.

3.1. CrmTagService

CrmTag createTag(Map params)

Create a new tag.

void deleteTag(String name, Long tenantId = null)

Delete an existing tag.

Deleting a tag definition will also delete all occurrences of this tag on domain instances.

void deleteLinks(reference)

Delete all tags on the domain instance reference.

void setTagValue(def instance, Object[] args)

Set value of a tag associated with a domain instance.

def getTagValue(Object instance, String tagName)

Get the value of a tag associated with a domain instance.

boolean isTagged(final Object instance, String tagName)

Check if a domain instance has been tagged with a specific tag.

Collection deleteTag(Object instance, String tagName)

Delete a tag associated with a domain instance.

PagedResultList findAllByTag(Class clazz, Object[] args)

Find all domain instances with a specific tag.

4. Code Examples

Filter domain instances that are tagged with a specific value.

List<Person> everyone = Person.findAllByTenantId(1L)
List<Person> veryImportantPeople = everyone.findAll{it.isTagged('vip')}

The code above is very inefficient because it queries all records from the database then check each one if it got the tag. In this case it’s better to use the domain class method findAllByTag because it uses a more efficient SQL query.

List<Person> veryImportantPeople = Person.findAllByTag('vip')
findAllByTag() automatically applies a tenant filter to the query, so the query above will only find people in the current executing tenant.

5. Changes

2.4.2

Tag values are now deleted when the owning domain instance is deleted

2.4.1

The method domainInstance.isTagged(String) is now case insensitive

2.4.0

First version compatible with Grails 2.4.4.

2.0.0

First public release.

6. License

This plugin is licensed with Apache License version 2.0

7. Source Code

The source code for this plugin is available at https://github.com/goeh/grails-crm-tags

8. Contributing

Please report issues or suggestions.

Want to improve the plugin: Fork the repository and send a pull request.