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.

Each GR8 CRM plugin defines a Bounded Context that focus on one specific domain, for example contact, project or document.

1.2. Custom Properties Plugin

This plugin makes is possible for an application super-user to define custom properties for domain classes. A custom property can be of type string, number and date.

2. Add custom properties

Two user-facing views are provided by the plugin. One displayed in the show-contact view and one displayed in the edit-contact view. The views are not added automatically but you can easily add them in BootStrap.groovy for your application.

The following code snippet adds custom property views to the contact views (company, person, etc.)

class BootStrap {

    def crmPluginService
    def crmCoreService
    def crmPropertyService

    def init = { servletContext ->
        // Add custom property tab to show contact page.
        crmPluginService.registerView('crmContact', 'show', 'tabs',
                [id: "props", index: 120, label: "Properties", template: '/crmProperty/show', plugin: "crm-property", model: {
                    def rid = crmCoreService.getReferenceIdentifier(crmContact)
                    def result = crmPropertyService.getConfigs('crmContact')
                    def values = crmPropertyService.getValues(crmContact)
                    return [bean: crmContact, reference: rid, result: result, totalCount: values.size()]
                }]
        )
        // Add custom property tab to edit contact page.
        crmPluginService.registerView('crmContact', 'edit', 'tabs',
                [id: "props", index: 120, label: "Properties", template: '/crmProperty/edit', plugin: "crm-property", model: {
                    def rid = crmCoreService.getReferenceIdentifier(crmContact)
                    def result = crmPropertyService.getConfigs('crmContact')
                    def values = crmPropertyService.getValues(crmContact)
                    return [bean: crmContact, reference: rid, result: result, totalCount: values.size()]
                }]
        )
    }
}

3. CrmPropertyService

The crmPropertyService bean provides methods for configuring and working with custom property values.

crmPropertyService.createStringConfig(CrmContact, "team", "Team name")
crmPropertyService.createNumberConfig(CrmContact, "weight", "Weight (kg)")
crmPropertyService.createDateConfig(CrmContact, "birthDate", "Birth date")

4. Instance methods

Each domain class that has a static property called customProperties will have instance methods for setting and getting custom property values.

def person = CrmContact.findByName("Mr Groovy")

person.setCustomProperty('team', 'Grails')
person.setCustomProperty('weight', 82)
person.setCustomProperty('birthDate', '1992-05-23')

5. Changes

2.4.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/technipelago/grails-crm-property

8. Contributing

Please report issues or suggestions.

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