Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get rid of the warning in the Condition & Config script for custom email post function Edited

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" @line 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

1 answer

0 votes

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 _Adaptavist_ not sure I am following. Can you provide additional details? Thanks --Lara

Comment this line in your code.

def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issue.key)

@Ravi Sagar _Adaptavist_ 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. Email Post function.JPG

When I try and run it to preview, I get this:

Email post function error.JPG

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,142 views 8 28
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you