How to render html content in postfuntion name of jira workflow add-on?

I'm building a JIRA add on that contains some workflow post-functions. I want to customize the description UI when attempting to select a post function for a transition from the available choices. I know this can be done, because the Jira Workflow Toolkit plugin does just this by placing some HTML content after the description.

https://i.stack.imgur.com/mt8eJ.jpg

In the atlassian-plugin.xml, the workflow function is listed with a name key and a description key, like so:

<workflow-function key="abcdefg" name="Abcdef G" i18n-name-key="abcdefg.name" class="jira.plugins.postFunctions.workflow.AbcdefGFactory">
  <description key="abcdefg.description">This is what Abcdef G does...</description>
  ...
</workflow>

There is a resource file also listed in the plugin xml that contains the previously mentioned keys,

abcdefg.name = Abcdef G
abcdefg.description = This is what Abcdef G does...

I have velocity templates for view and input, but those don't correspond to the view of selecting a post function for a transition. I can't seem to find a factory method that would over-ride that display either.

How can I tap into the rendering of that Name or Description field in the Add Post Function To Transition view?

1 answer

1 accepted

I found out that all I had to do was add a WebResource consisting of a javascript file with the right contexts. The javascript looks for my postfunction labels and adds the little bit.

In the atlassian-plugin.xml:

<webresource ...>
<description>...</description>
<resource name="..." type="download" location="js/doit.js"/>
<context>atl.admin</context>
</webresource>

Then the javascript file looks something like this:

AJS.$( document ).ready(function() {
annotateWorkflowPostFunctions();
});

function annotateWorkflowPostFunctions() {
var labels = AJS.$("label[for*='mykey']");
labels.each(function() {
$( this ).append(
'<span class="aui-lozenge aui-lozenge-error">By Mike</span>'
);
});
}

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,870 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot