Using custom button from ScriptRunner fragment to open existing transition dialog screen

Muhammad Muzakkir Abdul Malek
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 4, 2024

I had created a custom button using script runner fragments (custom web item). location 'operations-top-level'. Do what = Do nothing - you will use javascript to bind an action. Link = empty

Screenshot 2024-12-05 115108.png

(red = custom button, green - exsisting transition workflow button)

below is my script:

AJS.$(document).ready(function () {
var buttonClickHandler = function(e) {
e.preventDefault();
var actionUrl = "/secure/WorkflowUIDispatcher.jspa?id="+JIRA.Issue.getIssueId()+"&action=511";
var atlToken = AJS.$('input[name="atl_token"]').val();

const workflowLink = document.createElement('a');
workflowLink.href = actionUrl+"&atl_token="+atlToken;
workflowLink.style.display = "none";
document.body.appendChild(workflowLink);

workflowLink.click();

document.body.removeChild(workflowLink);
}
AJS.$("#jira").on("click", "#update-ratings-button", buttonClickHandler);
});

 

when I clcik on original button, it will open a pop up dialog screen look like this:
Screenshot 2024-12-05 115531.png

but when i clcik on the custom button it open the transition to whole new page:

Screenshot 2024-12-05 115731.png

 

so is there a way to make it open in dialog screen as the original one? or other alternative bring the original buttton outside from dropdown. but only for this specific button. since other transition need to be kept in dropdown.

my main objective is to bring the button in issue view screen, for easy access 

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 29, 2024

Hi @Muhammad Muzakkir Abdul Malek

If you intend to invoke a Dialog via ScriptRunner's Fragment Web Item, I suggest following the steps in this ScriptRunner Documentation. You will need to make a REST Endpoint request to the transition screen and add the javascript to it.

I hope this helps to answer your question.

Thank you and Kind regards,
Ram

Suggest an answer

Log in or Sign up to answer