Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Email to assginee with ScriptRunner ScheduledJob

dD
Contributor
September 28, 2021

Hello,

I am trying to create a scheduled job with scriptrunner, where at one specific time in a year, emails are send to specific assignees of certain tickets. Additionally I want a Custom Field (soseCustomField) to match a specific value (aktiv) and only then, send the mail. But unfortunately I didnot even manage to Define the issue without errors.

figure_c.GIF

1 answer

0 votes
Mohamed Benziane
Community Champion
September 29, 2021

Hi,

When you use

issue.getIssueObject()

this will return an object from mutableIssue and not from Issue

https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/IssueManager.html#getIssueObject-java.lang.Long-

And you forget to pass a parameter in you getIssueObject method.

So you code should look like this

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue


IssueManager issueManager = ComponentAccessor.getIssueManager()
MutableIssue issue = issueManager.getIssueObject(10000)

Suggest an answer

Log in or Sign up to answer