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

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

ScriptRunner Fields Changed Validator - No message shown to user Edited

I'm using ScriptRunner's Fields Changed Validator to make sure the Time Spent (the validator notes this as "Log Work") field is changed during a workflow transition.  I can see that this validator is accurately preventing the transition from working if Time Spent is not entered on the transition screen, however this validator doesn't tell the user what is wrong - the transition screen just sits there until the user guesses at the field that is preventing the transition.

Using the latest ScriptRunner and Jira Software Server LTS at the moment.

2 answers

1 accepted

1 vote
Answer accepted

A quick workaround is to use Simple Scripted Validator instead. I found this Community discussion that can be useful for this case. 

The script to be used:

import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.MutableIssue

Map<String,ModifiedValue> modifiedValues = ((MutableIssue)issue).getModifiedFields();

return modifiedValues.containsKey("worklog")

Nice find. 

I'm not super familiar with the getModifiedFields() method.

Thanks for the workaround, I confirmed this works on the dev/test server.

1 vote

This seems like something you should report to productsupport.adaptavist.com/servicedesk

But if you don't want to wait for a fix, you can create a simple scripted validator instead:

2021-06-30 17_43_15-Add Workflow Function Parameters.png

Thanks for the suggestion, but the simple scripted validator doesn't work.  If I put time in the Time Spent field during the transition it still throws the validation message.  We've had this issue forever with checking for issue links added during transitions as well.

I'll see where I can get with Adaptavist support.

You are correct, I obviously hadn't tested my suggestion.

Like you, I can't figure out how to access the log work details submitted as part of a transition screen.

But maybe I can suggest a different workaround using behaviour. It's still not perfect.

2021-07-13 09_28_45-Window.png

This issue I have here, is that the message is only visible when you've checked the "log work" box to expand and view the dependent fields. The form is still prevented from submitting, however. So maybe tagging the error to another field would be necessary

Suggest an answer

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

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

786 views 2 22
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