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 can I get linked issues from a transition screen with SIL?

Preamble

I am trying to add a requirement to add an 'Is Blocked By' issue link to a ticket when performing a certain transition.

I have SIL code that does this here:

if (size(linkedIssues(key, "Blocks", -1)) == 0) {
return false, "comment", "You must add an 'is blocked by' ticket link to denote which issue is blocking this work.";
};

This basically says that if the amount of linked issues with the 'Blocks'  type is zero, don't allow the transition and give an error message.

This works fine, but unfortunately it means that a user has to add the link through the 'More' menu, then make the transition.  Or more commonly, try to transition, then go back through that.

For other similar issues, I have used the 'HasInput' method to figure out if a field in a transition screen has content.  For example, the following will validate that either Assignee or a custom field is populated in order to make a transition:

if(hasInput("assignee")) {
return true;
};
if(hasInput("customfield_10900")) {
return true;
};
if(isNotNull(assignee)) {
return true;
}
if (isNotNull(customfield_10900)) {
return true;
};
return false, "comment", "Please provide a value in either the 'Assignee' or 'Group' field to queue this ticket.";

Question

What do I need to do to make the 'hasInput' method work with the Linked Issues field.  I have tried the following but with no luck:

if(hasInput("linkedIssues")) {
return true;
};

Does anyone know what that string needs to be?  And where I can see all the strings used for default Jira fields?  Also, can I extend that 'hasInput' method to also check that the user has specified the 'Is Blocked By' link type, as well as a ticket to link to?

1 answer

@Matt Albone  - I have asked vendor (cprime) the same question.

The answer was:

Hi Konstantin Iakovlev, sorry about this. We have supported the Linked Issues field in the past. However, for a while the HTML and CSS for this field would change every single time a new version of Jira was released and it became to much work to support a single field. Perhaps it is time to take another look. If you are trying to create a validator you can use Java Script like the code below. You would need to use Live Fields and use the lfExecuteJS() routine to call it.

 Hope this helps

Jonathan Muse
Product Manager

//Not used as far as I can tell, served as a base for the updated version in setDefectSource.js

AJS.$(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { requireFields(); checkLinks(); }); function requireFields() { $('#issue-workflow-transition-submit').click(function() { var link = checkLinks(); }); } function checkLinks() { AJS.$("label:contains('Linked Issues')").append("<span class='aui-icon icon-required'>Required</span>"); $('#create-issue-submit, #issue-create-submit, #edit-issue-submit').click(function() { var size = AJS.$("#issuelinks-issues-multi-select.jira-multi-select > div.representation ul li").length; if (size == 0) { removeMessages(); AJS.messages.error(".form-body", { id: 'ps-message', body: '<p>You must have a link for this issue.</p>', insert: 'prepend', closeable: false }); return false; } else { removeMessages(); } }); } function removeMessages() { AJS.$(".aui-message-error").each(function() { if($(this).attr('id') == 'ps-message') { $(this).hide(); } }); } });

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...

748 views 12 19
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