Scriptrunner to validate 'create/edit' fields Edited

Hi all, 

Am very new to Scriptrunner so I may be misunderstanding but I have been asked to implement it to essentially do validation on the issue create/ edit screens. For example: 

Field 1 = ABC

then field 2 drop down must = XYZ 

I guess I would either like to provide a validation message or if possible actually modify the second field to change its value based on the first field. 

I am just wondering if I can use Scriptrunner in this way at this level? A lot of what I have read indicates that these kinds of transitions can be done during workflows but I am aiming to do them on creation/ edit of tickets.  

Any guidance on where to get started in order to write and trigger scripts on create/edit screens would be greatly appreciated!  

2 answers

1 accepted

This widget could not be displayed.
Jenna Davis Community Champion Oct 25, 2017

Hello, 

I believe you'll want to start looking into behaviours. There is also an example in the ScriptRunner documentation here that does something similar to what you described. If you want to learn more, you can read through the behaviour recipes

Hope this helps! Let me know if you have any questions. 

Jenna Davis

Hi Jenna, 

Apologies another question, I couldnt see a way to get behaviours to throw up a error message so moved on to use simple scripted validators. Although from what I understand these wont work on issue edit? 

What should I be using to throw up error messages when users input invalid data on the edit screen? 

And am I incorrect in thinking behaviours cant put up error messages to the end user? 

All the best, 

Bobby

You can use .setHelpText() and .setDescription() in your behaviour to give messages to your users.

A validator can also be used to do this. :)

This widget could not be displayed.

EDIT: Ignore this, found that this is done at the Workflow level. 

 

Hi, 

 

Many thanks for the advice, I actually found something which I think would be very useful here: 

https://scriptrunner.adaptavist.com/4.3.9/jira/recipes/workflow/validators/simple-scripted-validators.html

 

Where are simple scripted validators for create and edit implemented?

All the best, 

 

Bobby 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

733 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you