Which JIRA.Events fired when issue created from Issue View Page

Hi all,

In Issue View Page, which JIRA.Events fired when an issue created successfully (for both clicks on Create button on the Jira’s Header and click on plus icon of the Issues in Epic panel)

I want to bind this event to be able to handle my UI after an issue in epic is created.

Thanks a lot!

Hi @nhac.tat.nguyen,

Check these code in your JavaScript.

Note: Check the behavior of reason and context values in different operation like create and update issue.

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason ) {
		// dialogReady
		console.log("Reason ------------------------------", reason);
		console.log("Context ------------------------------", context );
});
JIRA.ViewIssueTabs.onTabReady(function(e) {
// dialogReady
});
1 Like

Hi @dchouksey89,

I have checked all the events from JIRA.Events, but nothing meet my need.

The event JIRA.Events.NEW_CONTENT_ADDED only fired at the beginning, when the create issue dialog opens.
But I need to detect the event when an issue created successfully and the dialog closed.

Hi,

Did you check with the reason and context values like below code:

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason ) {
		// dialogReady
		//console.log("Reason ------------------------------", reason);
		//console.log("Context ------------------------------", context );
		

		if (reason == JIRA.CONTENT_ADDED_REASON.panelRefreshed) {
			// write some logic there you can cross verify like issue key is created or not. May be some field values 
                       /*if(context[0]!= null && context[0].id == "details-module"){
				
			}*/
        }
 });
1 Like

Hi,

The event NEW_CONTENT_ADDED is not fired AFTER we create issue, it is only fired when we open the dialog and start create issue. And I expect some Event after that dialog is closed, and an issue is created successfully.

And since we have no event to bind, we have no reason and context to check :frowning:

Found the solution!

This solution is applied only for Issue In Epic creation (click plus button on Issues in Epic web panel).

Please override the following method (from Greenhopper) to do what you want after an Issue in Epic is created.

GH.QuickCreateIssueInEpic.handleIssuesCreated = events => {
    events.forEach(event=> {
        console.log("Issue Created: " + event.createdIssueDetails.key);
    });
}

For other cases, eg click Create button on the top navigator, or click create sub-task from Sub Task web panel, I did not find any solution for them.

2 Likes

For Create button on the top navigator, try below.

JIRA.bind("QuickCreateIssue.sessionComplete", function (evt, issues) {
		    AJS.$.each(issues, function () {
		    	console.log(this.issueKey);
		    });
	    });

For click create sub-task from Sub Task web panel, try below.

JIRA.bind("QuickCreateSubtask.sessionComplete", function (evt, issues) {
            AJS.$.each(issues, function () {
		    	console.log(this.issueKey);
		    });
        });