Hello
I am looking for a way to instantiate a Simple TaskLists template at issue creation, and I start with a Script Runner issue listener on create event
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
MutableIssue mutableIssue = (MutableIssue)issue;
mutableIssue.setDescription((issue.description ?: "") + "\n{tasklist}Validation{tasklist}");
IssueManager issueManager = ComponentAccessor.getIssueManager()
issueManager.updateIssue(event.user, mutableIssue, com.atlassian.jira.event.type.EventDispatchOption.DO_NOT_DISPATCH, false);
But it does not produce expected effect: "tasklist" macro is not evaluated and replaced by a list of "task:id=xxx" macros in description.
I guess this evaluation and replacement only happens in web editor.
So is there a way to programmatically call "tasklist" macro evaluation, so that my listener can generate tasks list from template?
hi @Yves Martin - our plugin evaluates the macros whenever an issue_event is fired. More often than not, when inserting a {task} macro, or {tasklist} macro and it doesn't get evaluated, it is because an issue event is not fired properly.
My experience with script runner is limited, but it is likely you need to change the last line to fire an actual event, like
EventDispatchOption.ISSUE_UPDATED
Hope that helps.
Cheers,
Anthony
Hello @Anthony De Moss Correct! It is required to fire event for macro replacement. I was not aware about it, and choose "do_not_dispatch" to avoid additional notification. Many thanks. Yves
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.