MacroJsOverride gets stuck to all other macros!


We maintain a custom macro to insert some external content into Confluence pages. It works well, but I recently noticed that the HTML parameter fields of our custom plugin appears for any other macro that is subsequently opened in the Macro Browser. For example, if I open our macro in the Macro Browser and then the “insert code” macro, then only our macro’s parameters are displayed for the “insert macro”!

A very much shortened summary of our plugin code is like this:

AJS.toInit(function() {
	AJS.MacroBrowser.setMacroJsOverride('my-macro', {
		opener: function(macro) {
			AJS.$("#macro-insert-container .macro-input-fields").html("HTML TO DEFINE OUR PARAMS");
			metadata = AJS.MacroBrowser.getMacroMetadata('my-macro');
			var macroData = {};
			$.extend(true, macroData, metadata); // clone the metadata to a new object
			if (!macroData.formDetails) macroData.formDetails = {
				"macroName": "my-macro",
				"parameters": [
					{ "type": { "name": "string" }, "required": false, "name": "name" },
					{ "type": { "name": "string" }, "required": false, "name": "id" }
			if (!macroData.formDetails.body) macroData.formDetails.body = {"content": ""};

			// Update the dialog activeMetadata in order to allow the macro reload via refresh button
			AJS.MacroBrowser.dialog.activeMetadata = macroData; // This is important to getMacroBody.

			// Preview the macro (but only if processing required parameters succeeds)
			if (AJS.MacroBrowser.processRequiredParameters()) {

I have no clue what we’re doing wrong, but it must have to do with the way we set a customJsOverride and copy around the metadata. Does anyone have some advice on what we might be doing wrong?