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

Default Jira massage has shown instead workflow validator massage

hello

I wonder if it's a bug or not,

I added workflow validator (Simple scripted validator of ScriptRunner).

The validator works as expected at the "create" step but not at the "resolve". If the script returns a false value the transition will be blocked with the error message I have defined. but at "resolve" stage its return default Jira massage:

"It seems that you have tried to perform an illegal workflow operation.

If you think this message is wrong, please contact your JIRA administrators."

In this to transitions there is no configured screen.

 

Thank you! 

Noaimage.png

2 answers

1 accepted

Hi @Noa Masel ,

 

Welcome to Atlassian Community!

In my understanding, when you opt to use the "Simple scripted validator", you need to add in your code the instructions to display a message explaining the reason that the Validator failed.

See below example from Scriptrunner documentation, where it throws an InvalidInputException exception if the issue has no fix versions during its closure transition. 

import com.opensymphony.workflow.InvalidInputException

if (issue.getResolution() == "Fixed" && ! issue.fixVersions) {
throw new InvalidInputException("fixVersions",
"Fix Version/s is required when specifying Resolution of 'Fixed'")
}

https://scriptrunner.adaptavist.com/latest/jira/tutorials/scripted-validators-tutorial.html#__em_custom_script_require_fix_version_em

Can you include this exception in your validator script and let me know the outcome?

Thank you @Italo Qualisoni _e-Core_ 

My script is checking if the custom field SR-type filled while user open SR ticket.

My simple script  is:

cfValues.get("Service Request Type")?.keySet()?.size() == 2image.png

As I wrote, the validator works as expected at the CEREATE transition, but not at the RESOLVE transition (I added the same validator at the resolve transition because sometimes the ticket opened as bug or task instead of SR, and when I move it to SR the ticket already created and validator doesn't work on the other transition, so before I close the ticket I want to validate if the SR-type field is filled...).

As you can see the massage is not part of the script.

Thank you!

Hi @Noa Masel ,

I was mistaken, you need to throw InvalidInputException when using the "Custom script validator".

My guess is that your transition don't have a screen and this might be part of your issue.

As a test, can you create a Screen containing your "Service Request Type" field and associate this screen in your resolve transition? Let me know if does this fix your issue.

I'm not sure if not working with none screen is a bug or expected behavior, I might need to open a ticket to Adaptavist to get their response on that.

Thank you @Italo Qualisoni _e-Core_ I'll try and let you know!

Expected.  Not giving the user a reason for the failure is the primary reason we usually avoid using validators.  It just introduces confusion.

Suggest an answer

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

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

132 views 3 7
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