Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
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);
reminderService.addReminder(reminder);

Deleting Existing Reminders of The Issue

...