Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

assign an organization to all issues

Joe Sternlicht September 29, 2016

Does anyone have an easy way to assign all issues to an organization? The new feature is great but none of the existing tickets are visible to the organization because they do not have the organization set. Bulk Edit does not seem to have a way to update the organization. Any ideas on how to do this programmatically or via bulk edit?

2 answers

0 votes
Joe Sternlicht October 14, 2016

What I ended up doing is to use Selenium to script opening each issue and assigning an organization. I used JQL (issue search) to list all of the tickets, copied the issue ID's, made that an array in a selenium script, and ran it on the array. The script was not very good, I'm sure if I had more than a hundred I would have worked harder to make it better, but this worked well enough, took a while to do them one at a time but it was just a hack,

Replace MyCompany (part of your Atlassian url), MyOrganization (name of the organization you want to set), and MyDeskID (the issue prefix for service desk) and of course the array of issue ID's...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://mycompany.atlassian.net/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>storeEval</td>
    <td>myArray = new Array('52', '51', '50', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27', '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10', '9', '4');</td>
    <td>myArray</td>
</tr>
<tr>
    <td>storeEval</td>
    <td>0</td>
    <td>index</td>
</tr>
<tr>
    <td>while</td>
    <td>index &lt; storedVars['myArray'].length;</td>
    <td></td>
</tr>
<tr>
    <td>store</td>
    <td>javascript{storedVars['myArray'][storedVars['index']]}</td>
    <td>issueid</td>
</tr>
<tr>
    <td>echo</td>
    <td>javascript{storedVars['issueid']}</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>&quot;https://mycompany.atlassian.net/browse/MYDESKID-&quot;+storedVars['issueid']</td>
    <td>myURL</td>
</tr>
<tr>
    <td>echo</td>
    <td>javascript{storedVars['myURL']}</td>
    <td></td>
</tr>
<tr>
    <td>open</td>
    <td>javascript{storedVars['myURL']}</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=span.trigger-label</td>
    <td></td>
</tr>
<tr>
    <td>waitForPageToLoad</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=customfield_13300-textarea</td>
    <td></td>
</tr>
<tr>
    <td>sendKeys</td>
    <td>id=customfield_13300-textarea</td>
    <td>MyOrganization</td>
</tr>
<tr>
    <td>pause</td>
    <td>1000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=MyOrganization</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=edit-issue-submit</td>
    <td></td>
</tr>
<tr>
    <td>echo</td>
    <td>javascript{storedVars['index']}</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>storedVars['index'] + 1;</td>
    <td>index</td>
</tr>
<tr>
    <td>echo</td>
    <td>javascript{storedVars['index']}</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>

 

0 votes
Robert Nolan October 14, 2016

Ok, it's not as simple as Bulk Edit (so please Atlassian add Organizations as a Bulk Edit option!!) but I have managed to update all issues using the CSV import guide here

Bear in mind though, when you are adding Organizations to the CVS file:

  • the header is: Custom field (Organizations)
  • the Organizations value in the CSV file must be numeric. The number value of your Organization is determined by the order in which you added Organizations to your JSD. So the first Organization added is 1, the second added is 2, etc. etc.
  • You will need to add Summary to the CSV file to allow it to import
  • You should choose External System Import, NOT JIRA Import from the Import & Export options

HTH,

Rob

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events