Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Create plugin/module/script to handle custom condition/validation on Cloud JIRA

Hi

I know my question is quit about everything, that is because I am a bit confused here.

I want to create a Condition that through an error message to the user rather than just not allow them to make the transition on the workflow. A Validator did not help as It did not allow checking values of custom fields. And I do not really know how the user should use it (when I add validation to change value before transition for a certain existing field I get an error message even after changing that value. So not sure how that really works). 

From reading other questions/answers, it seems I need to create custom Condition/Validator. On this front, I have two questions:

1- Can I create such a thing on Cloud JIRA? Or it has to be JIRA Server instance?

2- Where do I start with that exactly? Do i need to first create a Plugin, which hosts a Module, which then contains my conditional logic? Or what?? And what is that OnDemand?

I really hope someone can put me in the right path as now I am lost smile

Thanks

Fadi

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted

I think you've almost got it, but you do need to decide whether to use a condition or a validator quite carefully

A condition hides a transition from a user for some reason.  It's a simple yes/no decision on whether to display the transition, there's no way to feed anything back to the users because the system is designed to hide it completely. 

A validator checks data on the issue after the user enters something.  A lot of descriptions I see say "it validates what the user enters before committing it", but that is not quite accurate.  A validator checks all the data that would be committed - you can have validators that don't check any of the data entered by the user.   Validators can feed back to the user.  If they pass, the transition moves on, if they fail, they can return an error message, which JIRA will give to the user.

So, to break down your main question:

>I want to create a Condition that through an error message to the user rather than just not allow them to make the transition on the workflow.
You'll need to rewrite the way JIRA works to do that.  Conditions don't have feedback

>A Validator did not help as It did not allow checking values of custom fields.
They do allow checking of custom fields, but my guess is that you don't have any validators installed that can do that.  JIRA ships with a very sparse set of validators, and most admins are very fond of adding the JIRA Suite Utilities which add loads (free, well supported, available on server and cloud - well worth a look)

>when I add validation to change value before transition for a certain existing field I get an error message even after changing that value.

I suspect your validator looked at the current field value, not the value the user just entered.

>create custom Validator.

  1. On Cloud, no, you can only install the pre-approved add-ons, such as the JIRA Suite Utilities
  2. If you were on server, I'd refer you to both the ScriptRunner add-on, which bypasses the need for add-ons (you can add a scripted validator and write minimal code straight into a text box), and then the development docs for writing add-ons

@Nic Brough [Adaptavist] many many thanks for this detailed answer!

It is now clear what I am doing wrong and what I need to do smile

I will check the Suite Utilities you recommended.

Regarding my question about how Validators work, you said "...your validator looked at the current field value, not the value the user just entered." The thing is, when the user "just enters" a new value and then transition, this new value is not accepted by the Validator! How do I change a value for the validator to consider as new not current?

You haven't said what validator you are using, or where it comes from (Marketplace addon? built-in? your own add-on?)

First of all, JSU (Jira Suite Utilities) is not Cloud-compatible. JMWE (Misc Workflow Extensions) is offering only Post-functions to Cloud, but not any Validators. For example, it has a terrific validator "Field Required(JMWE)" that adds conditional execution  to the Field Requiredness as well. Even Power Scripts plugin (previously JJupin) offers Conditional Validation, but not offering for the Cloud version. 

So, these two Cloud compatible plugins (JMWE and Power Scripts) make me wonder if Jira Cloud is not yet ready for accepting any plugin Validators at all!! Can someone kindly confirm it??

As a matter of fact, Jira Cloud started supporting the creation of Conditions and Validators in apps only last month. And following that, JMWE for Jira Cloud will release a first batch of Conditions and Validators early April. Unfortunately, they will still be more limited than on Jira Server. For example, you won't be able to check the fields that were input on the transition screen - only the value of issue fields, however/whenever they were set.

It is good that Cloud finally started to allow Conditions and Validators, even the weaker "but still can't check input like Server has been able to do since Jira 2".  But a 3-year-old conversation is the wrong place to talk about it.

TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

167 views 6 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