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

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 Marketplace Apps & Integrations

☕️ Monday coffee with Jexo: Weekly Atlassian news roundup | 21st June 2021

Hi community 👋, as every Monday we're bringing you a quick update on what happened in the Atlassian ecosystem last week. There were a few interesting events like for example the announcement of th...

56 views 0 6
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