Category Mappings

Behaviours are mapped to projects (and optionally issue types within projects) or service desks (optionally request types). To map a behaviour to several related projects, map to project categories rather than individual projects. Map behaviours to a project category using a Custom Listener to update mappings using a simple API.

Set up a Global listener to handle a ProjectCategoryChangeEvent, and add as many category mappings as required (project or service desk mappings). When a project has a category added or removed, the event handler fires, and mappings relevant to that category are updated.

Create a Custom Listener to update mappings

  1. In Note, enter a description for the listener, for example, Update Mappings.
  2. Select Global to apply the listener to all projects on your instance. 
  3. Select ProjectCategoryChangeEvent in Events.
  4. Add a script to the Script field specifying the project category and behaviour. See below for some script examples.

    If there is more than one behaviour with the same name, only one of them is updated (the first). Please check your behaviour names before attempting this and edit where necessary. 

Examples

To map all projects in My Category to a behaviour named My Behaviour:

                    import com.onresolve.jira.behaviours.BehavioursCategoryMappingService
                    import com.onresolve.scriptrunner.runner.customisers.PluginModule
                    
                    @PluginModule
                    BehavioursCategoryMappingService categoryMappingService

                    categoryMappingService.categoryProjectMapping(event, 'My Category', 'My Behaviour')
Copy

To map just issue types Bug and Task in projects in My Category to a behaviour named My Behaviour:

                import com.onresolve.jira.behaviours.BehavioursCategoryMappingService
                import com.onresolve.scriptrunner.runner.customisers.PluginModule
                
                @PluginModule
                BehavioursCategoryMappingService categoryMappingService

                categoryMappingService.categoryProjectMapping(event, 'My Category', 'My Behaviour', 'Bug', 'Task')
Copy

To create a service desk mapping to all service desk projects in My Category to a behaviour named My Behaviour:

                    import com.onresolve.jira.behaviours.BehavioursCategoryMappingService
                    import com.onresolve.scriptrunner.runner.customisers.PluginModule
                    
                    @PluginModule
                    BehavioursCategoryMappingService categoryMappingService
                    
                    categoryMappingService.categoryServiceDeskMapping(event, 'My Category', 'My Behaviour')
Copy

To create a service desk mapping for request types Employee exit and New employeeto all service desk projects in My Category to a behaviour named My Behaviour:

            import com.onresolve.jira.behaviours.BehavioursCategoryMappingService
            import com.onresolve.scriptrunner.runner.customisers.PluginModule
            
            @PluginModule
            BehavioursCategoryMappingService categoryMappingService
            
            categoryMappingService.categoryServiceDeskMapping(event, 'My Category', 'My Behaviour', 'Employee exit', 'New employee')
Copy

On this page