Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Services of “Issue Reminders” app can be accessed by Script Runner and other plugins. You can browse Issue Reminders JavaDoc for available services. You can use this feature to create automatic reminders when status of an issue is changed.

Following script adds a new Reminder for assignee of the issue. Reminder is scheduled after 3 days when the issue is transitioned.

import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.deniz.jira.reminders.service.ReminderService;
import com.deniz.jira.reminders.data.*;
import com.atlassian.jira.component.ComponentAccessor

def project = issue.getProjectObject()

@WithPlugin("com.deniz.jira.reminders")

// Inject plugin module
@PluginModule
ReminderService reminderService;

def ReminderImp reminder = new ReminderImp();
reminder.summary = "the time has come";
reminder.longDescription = "Issue reached reminder-date!";
reminder.issueId = issue.id;
Instant inst = Instant.now().plus(3,ChronoUnit.DAYS);
reminder.reminderDate = Date.from(inst);

def target = new ReminderTargetImp();
target.identifier = issue.assignee.key;
target.targetType = ReminderTarget.ReminderTargetType.USER;
reminder.addReminderTarget(target);
  • No labels