Forums

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

Show custom help info based on Components

T0pH0ur January 22, 2019

On Jira Server vers 7.2.7

 

I used this reference to make an embedded help tip, but the result is very long due to the number of components

https://confluence.atlassian.com/jira064/creating-help-for-a-custom-field-720412166.html#

I am interested if possible to only show the div based on the component/s selected, but my code keeps crashing when trying to access the component. My script is in the Component/s description viewable in the configurations

Here is the script I have come up with after modifying what was provided in the example

I thought this would iterate through each component on the issue and only show the divs for the components. (Note I was trying with just the one component to get it working first)

<script type="text/javascript">
import com.atlassian.jira.component.ComponentAccessor;

function showHelp() {
Collection components = issue.getComponents();
Iterator componentIterator = components.iterator();
while (componentIterator.hasNext()){
GenericValue component = (GenericValue)componentIterator.next();
String compName = component.getString("name");
if (compName == 'ComsAlert'){
var listenersDiv = document.getElementById("ComsAlertHelp");
if (listenersDiv.style.display == 'none') {
listenersDiv.style.display = '';
} else {
listenersDiv.style.display='none';
}
}else{
var listenersDiv = document.getElementById("FailedTest");
if (listenersDiv.style.display == 'none') {
listenersDiv.style.display = '';
} else {
listenersDiv.style.display='none';
}
}
}
}
</script>

//divs below 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events