/
Hide attributes depending on project
Hide attributes depending on project
In this example, we will hide two checkbox attributes if the users try to log work on any other project than the project ITSD. These two checkboxes only need to be shown when work is logged on ITSD-issues.
Hide fields depending on project
// Enter your fieldnames here: var firstItemName = 'OnCall'; var secondItemName = 'Remote'; var projectKey = 'ITSD'; // Don't change the code below this line var tempoList = '.tempoStaticList'; var hideItemOne = '#popup_' + firstItemName + '_'; var hideItemTwo = '#popup_' + secondItemName + '_'; AJS.$(document).ready(function() { AJS.$('#time-popup').live('focus', function() { if (AJS.$('#tempo-issue-picker-popup').val()[0].indexOf(projectKey) == -1 || AJS.$('input[name="preSelectedIssue"]').val().indexOf(projectKey) == -1) { AJS.$(hideItemOne).parent().hide(); AJS.$(hideItemTwo).parent().hide(); } }); AJS.$('#tempo-issue-picker-popup').live('change', function() { if (AJS.$('#tempo-issue-picker-popup').val()[0].indexOf(projectKey) == -1) { AJS.$(hideItemOne).parent().hide(); AJS.$(hideItemTwo).parent().hide(); } else { AJS.$(hideItemOne).parent().show(); AJS.$(hideItemTwo).parent().show(); } }); });
In newer Tempo Timesheets versions, you can use this script.
// Enter your fieldnames here: var firstItemName = 'OnCall'; var secondItemName = 'Remote'; var projectKey = 'ITSD'; // Don't change the code below this line var hideItemOne = '#_' + firstItemName + '_'; var hideItemTwo = '#_' + secondItemName + '_'; AJS.$(document).ready(function() { setInterval(function() { if (AJS.$('#issuePickerInput').prev().prev().attr("name").indexOf(projectKey) == -1) { AJS.$(hideItemOne).parent().parent().hide(); AJS.$(hideItemTwo).parent().parent().hide(); } else { AJS.$(hideItemOne).parent().parent().show(); AJS.$(hideItemTwo).parent().parent().hide(); } }, 500); });
, multiple selections available,
Related content
Dynamic Dropdowns
Dynamic Dropdowns
More like this
Validate if Tempo Account is filled out before adding a Worklog
Validate if Tempo Account is filled out before adding a Worklog
More like this
User guide
User guide
More like this
Getting started with Custom JS for JIRA
Getting started with Custom JS for JIRA
More like this
JIRA Notification Banner
JIRA Notification Banner
More like this