Customizable Announcements for Jira - Java/Groovy/ScriptRunner api example

The plugin has a java api that can be used from scripts.

The example below demonstrates the basic api methods.

import com.atlassian.jira.component.ComponentAccessor import com.jibrok.jira.plugins.banner.service.BannerService import com.jibrok.jira.plugins.banner.dto.BannerDto import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.jibrok.jira.plugins.banner") @PluginModule BannerService bannerService List<BannerDto> banners = bannerService.getAll() BannerDto bannerWithId4 = bannerService.get(4) BannerDto newBanner = new BannerDto( [ users: ['admin'], groups: ['jira-software-users'], message: """ <a>test link</a><br> message """, color:"#4287f5", start: new Date(), stop: (new Date() + 1)//+ 1 day ] ) bannerService.create(newBanner) BannerDto updateBanner = new BannerDto( [ id:4, message: """<a>test link</a><br>message""", color:"#f2f542" ] ) bannerService.update(updateBanner) bannerService.delete(6)