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

How to validate Linked issue on transition screen

I have added Link Issues field to my Create and some of the Transition screens. I want to control on the Type of Issues which can be linked to a specific Issue Type. After couple of attempts I resorted to using SIL Validatiors in Create & Workflow Transitions. But I never get the list of issues which user is trying to Link when using linkedIssues API.

My guess here is, since the validators are called before the changes are saved, these API wont work when trying to fetch data which is at that instance transient. i.e. still pending to be written.

So if this wont work then, Is there something else which can be used in its place?

4 answers

1 accepted

0 votes
Answer accepted

Hi Salman,

You are completely right about the transient values.

As it stands now, the only way I can think of that would solve your problem is to use a live fields configuration that would call lfExecuteJS() to run some javascript code (this is not going to be easy) that would prevent the user from selecting the wrong issue type in the transition screen.

HTH

However, you can just remove the wrong issues in a post-function placed at the end of the post-functions chain, but i'm not sure "disappearing" issue links is acceptable practice.

Disappearing links is a no go. The JavaScript one is something I will look into. But I cant really get around my head how will I get the issuetype of the selected issues there. Thinking...

At this point I think your best option is to write your own addon that will provide the validator. It's easier than the javascript alternative.

Check out https://developer.atlassian.com/display/JIRADEV/Creating+Workflow+Extensions

It's complete with full example plugin source code and everything.

Hi Salman,

Can you please attach the SIL script that you are using as validator in Create & Workflow transitions? Plese let us know also what Jira and JJupin versions are you using.

Thanks,

Alex

I am using Jira 6.1.2 and JJupin 2.6.8

if (issueType == "Feature Task") {
    string [] linkedIssues = linkedIssues(key, "Contributes", 1);
    string errorMessage;

    if (arraySize(linkedIssues) > 1) {
        errorMessage = "Feature task can be associated to only 1 New Feature item.";
} else if (arraySize(linkedIssues) == 1) { for (string likedIssue in linkedIssues) { if (%linkedIssue%.issueType != "New Feature") { errorMessage = "Only a new feature can be set as Contributes to."; } } } if (length(errorMessage) > 0) { return false, errorMessage; } } 

Wouldn't it be easier to simply train your users instead of trying to force this on them?

Why aren't they allowed to link to certain issue types?

Best regards,

Peter

If it was that easy, there would have been no need for Validation & Condittions in Jira.

These restrictions are to enfore a workflow around specific type of issues based on the way things are done here. The end result is the reports as we need them :)

Like Helen Porter likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

641 views 7 23
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