Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi there Atlassian Community...
A few years back I had used the following in the 'Condition and Configuration' field to send a custom email (Jira v8.5.1 and SR v5.6.13.1-p5):
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.option.Options
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.RendererManager
import com.atlassian.jira.issue.fields.renderer.IssueRenderContext
import com.atlassian.jira.issue.fields.renderer.JiraRendererPlugin
def rendererManager = ComponentAccessor.getComponent(RendererManager)
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issue.key)
def wikiRenderer = rendererManager.getRendererForType("atlassian-wiki-renderer")
def renderContext = new IssueRenderContext(issue)
config.deschHTML = wikiRenderer.render(issue.description, renderContext)
return true
I'm now attempting on creating a custom email using the info I had before, and am getting a warning on the def issue line.
"Variable "issue" masks a binding variable of the same name. Please choose a different name for variable: "issue" @[deleted] 11, column 5."
Does anyone know what this should be and/or why this isn't working any longer? I've tried making several updates based on things I was able to find in the community, but nothing is working.
Currently running most recent versions of both Jira and ScriptRunner.
Thanks--Lara
Hi @Lara Arthur
In your post function you already have issue as a binding variable. So try the post function again by commenting that line.
Ravi
Hi @Ravi Sagar _Sparxsys_ not sure I am following. Can you provide additional details? Thanks --Lara
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Comment this line in your code.
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issue.key)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ravi Sagar _Sparxsys_ sorry, still not following. This is how the email post function is set up ....I've placed the line in the only spot it can go. This was working on an earlier version (I used the exact same format)...but it's not working now and giving me a warning.
When I try and run it to preview, I get this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.