Created
October 8, 2018 16:19
-
-
Save LaughDonor/09cfe7691dbeb0f3a47fa38c049e8337 to your computer and use it in GitHub Desktop.
Prefill JIRA Subtask Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Pre-fill SubTask Info | |
// @namespace https://jira.solutionstarit.com/ | |
// @version 0.1 | |
// @description Pre-fill JIRA Subtask information | |
// @author Sunny Patel | |
// @updateUrl https://gist.github.com/laughdonor/09cfe7691dbeb0f3a47fa38c049e8337/raw/jira-subtask-dev.user.js | |
// @match https://jira.solutionstarit.com/browse/* | |
// @grant none | |
// ==/UserScript== | |
/* globals $ JIRA */ | |
const fields = {summary: 'Dev - Coding and Review'}; | |
const role = "Dev"; // Or "QA", or "" as applicable | |
(function() { | |
'use strict'; | |
const roles = {'QA': 'customfield_11821', 'Dev': 'customfield_11823'}; | |
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(evt, node, type) { | |
if( type === "dialogReady" && node.parent("#create-subtask-dialog").length ) { | |
$("#assign-to-me-trigger").click(); | |
if( role.length ) | |
fields[roles[role]] = $('img.aui-ss-entity-icon', '#assignee-single-select').attr('src').match(/ownerId=(\w+)/)[1]; | |
$.each(fields, (id, val) => $("#" + id).val(val)); | |
const due = $("#duedate-trigger").click(); | |
setTimeout(() => due.get(0).scrollIntoView(), 20); | |
} | |
}); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment