Forums

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

Refresh Backlog after REST Update

Daniel NA June 16, 2025

Hi, I have written a Bookmarklet to update the labels of Tickets. To archieve this I have used the REST API, something like this:

var labelBody = '{ "update": { "labels": [ { "add": "' + label + '" } ] } }';
ids.forEach(key => {
var xhr = new XMLHttpRequest();
xhr.open("PUT", location.origin + "/rest/api/2/issue/" + key);
xhr.setRequestHeader("Content-Type","application/json");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status == 200) {
console.log(xhr.responseText);
}
else {
console.log(xhr.statusText)
}
};
console.log("Tag [" + label + "] for key [" + key + "]");
xhr.send(labelBody);
});

Where `ids` is a list of the selected ids of the tickets in the Backlog. This works perfectly fine ... BUT you have to press F5 and do a full reload of the page, which is a horrible user-experience (and makes it somehow unusable).

I tried various calls I found, like those:

JIRA.trigger(JIRA.Events.REFRESH_ISSUE_PAGE, [id]);
//or
JIRA.trigger(JIRA.Events.REFRESH_ISSUE_PAGE, [JIRA.Issue.getIssueId()]);
// even with a sleep before

So how do I programmatically refresh the affected issues in the backlog view, so that the labels are shown/refreshed. Thank you in advance

0 answers

Suggest an answer

Log in or Sign up to answer