The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding custom javascript to issue collector?

ICANSEEYOU7867
Contributor
May 26, 2022

I have been struggling with this, however I think I have a workable solution... however it is not the prettiest thing.

I am wanting to hide the User's Name and Email address fields, as I am populating this from the confluence page automatically.  Using the Fragment locator tool, I discovered that the custom template for an issue collector has:
Panel: wikiRendererWebPanel

I can add a "Show web panel" and add some javascript:

writer.write("""
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".contact-form-fields.field-group").hide();
});
</script>
""")

 

And this WORKS!  However due to a Jira bug, custom issue collector templates no longer work using an iframe in chrome:
https://jira.atlassian.com/browse/JRASERVER-73212
However, when you use the other templates (Got Feedbag? or Raise a bug), 
Panel: wikiRendererWebPanel no longer exists on the page.
So I have two questions...

Is there a better way to do this?  I think you can actually edit the template files on the server but I would rather have a scripted/scriptRunner way if possible.

And second question:
Is there a way to use a condition statement on an issue collector page?  I would like to restrict the code to running on a specific issue collector... however I have no idea how to do this.  I know the snippet shows:
jiraHelper.project?.key == "JRA"

But this didnt seem to work for restricting it to my project key with an issue collector.  I am not sure if I can verify the collector ID or do something else there?  Thanks!

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events