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

Listener condition fails

Hi,

I'm trying to create a "Clones an issue, and links" listener with condition based on 'Customer Request Type', but it doesn't work.

The condition script is:

import com.atlassian.jira.component.ComponentAccessor

def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Customer Request Type")
def requestType = issue.getCustomFieldValue(cf)

if(requestType.toString() == "sr/ad0f59b4-6224-4060-8d66-4e714a8e4a20")
{return true}

 

Can anyone helps please.

Many thanks,

Guy

3 answers

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader Feb 24, 2020

Hi @Guy Ayika ,

Looking at the examples I would use something like : 

log.error("Customer Request Type : " + cfValues['Customer Request Type'])
cfValues['Customer Request Type'] == 'sr/ad0f59b4-6224-4060-8d66-4e714a8e4a20'

I added the log of the field value in case that does not work so you can check it.

Thx for your prompt reply.

The listener seems to react correctly (no link issue created) when create issue with another Customer Request type, but with the correct one it's not creating anything also. I get this:

****

Time (on server): Mon Feb 24 2020 20:58:04 GMT+0100 (Central European Standard Time)

The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.

2020-02-24 19:58:04,046 ERROR [utils.ConditionUtils]: Customer Request Type : sr/ad0f59b4-6224-4060-8d66-4e714a8e4a20

*****

I have no clue what that means.

Hi,

Just added '?.value' and it works now. Many thx Antoine!

cfValues['Customer Request Type']?.value == 'sr/ad0f59b4-6224-4060-8d66-4e714a8e4a20'

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

📹 What is a Trello board?

Hi, Atlassian Community! My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Tre...

0 views 0 2
Read article

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