diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index 158416b..935b6e8 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -154,52 +154,71 @@
 
 
 	timeline_refresh: function(frm) {
-		// create button for "Help Article"
-		if (frappe.model.can_create("Help Article")) {
-			// Removing Help Article button if exists to avoid multiple occurance
-			frm.timeline.wrapper.find('.comment-header .asset-details .btn-add-to-kb').remove();
-			$('<button class="btn btn-xs btn-link btn-add-to-kb text-muted hidden-xs pull-right">'+
-				__('Help Article') + '</button>')
-				.appendTo(frm.timeline.wrapper.find('.comment-header .asset-details:not([data-communication-type="Comment"])'))
-				.on("click", function() {
-					var content = $(this).parents(".timeline-item:first").find(".timeline-item-content").html();
-					var doc = frappe.model.get_new_doc("Help Article");
-					doc.title = frm.doc.subject;
-					doc.content = content;
-					frappe.set_route("Form", "Help Article", doc.name);
-				});
-		}
-
 		if (!frm.timeline.wrapper.find(".btn-split-issue").length) {
-			let split_issue = __("Split Issue")
-			$(`<button class="btn btn-xs btn-link btn-add-to-kb text-muted hidden-xs btn-split-issue pull-right" style="display:inline-block; margin-right: 15px">
-				${split_issue}
-			</button>`)
-				.appendTo(frm.timeline.wrapper.find('.comment-header .asset-details:not([data-communication-type="Comment"])'))
+			let split_issue_btn = $(`
+				<a class="action-btn btn-split-issue" title="${__("Split Issue")}">
+					${frappe.utils.icon('branch', 'sm')}
+				</a>
+			`);
+
+			let communication_box = frm.timeline.wrapper.find('.timeline-item[data-doctype="Communication"]');
+			communication_box.find('.actions').prepend(split_issue_btn);
+
 			if (!frm.timeline.wrapper.data("split-issue-event-attached")) {
 				frm.timeline.wrapper.on('click', '.btn-split-issue', (e) => {
 					var dialog = new frappe.ui.Dialog({
 						title: __("Split Issue"),
 						fields: [
-							{fieldname: "subject", fieldtype: "Data", reqd: 1, label: __("Subject"), description: __("All communications including and above this shall be moved into the new Issue")}
+							{
+								fieldname: "subject",
+								fieldtype: "Data",
+								reqd: 1,
+								label: __("Subject"),
+								description: __("All communications including and above this shall be moved into the new Issue")
+							}
 						],
 						primary_action_label: __("Split"),
-						primary_action: function() {
+						primary_action: () => {
 							frm.call("split_issue", {
 								subject: dialog.fields_dict.subject.value,
 								communication_id: e.currentTarget.closest(".timeline-item").getAttribute("data-name")
 							}, (r) => {
-								frappe.msgprint(`New issue created: <a href="/app/issue/${r.message}">${r.message}</a>`)
+								frappe.msgprint(`New issue created: <a href="/app/issue/${r.message}">${r.message}</a>`);
 								frm.reload_doc();
 								dialog.hide();
 							});
 						}
 					});
-					dialog.show()
-				})
-				frm.timeline.wrapper.data("split-issue-event-attached", true)
+					dialog.show();
+				});
+				frm.timeline.wrapper.data("split-issue-event-attached", true);
 			}
 		}
+
+		// create button for "Help Article"
+		if (frappe.model.can_create("Help Article")) {
+			// Removing Help Article button if exists to avoid multiple occurrence
+			frm.timeline.wrapper.find('.action-btn .btn-add-to-kb').remove();
+
+			let help_article = $(`
+				<a class="action-btn btn-add-to-kb" title="${__('Help Article')}">
+					${frappe.utils.icon('solid-info', 'sm')}
+				</a>
+			`);
+
+			let communication_box = frm.timeline.wrapper.find('.timeline-item[data-doctype="Communication"]');
+			communication_box.find('.actions').prepend(help_article);
+			if (!frm.timeline.wrapper.data("help-article-event-attached")) {
+				frm.timeline.wrapper.on('click', '.btn-add-to-kb', function () {
+					const content = $(this).parents('.timeline-item[data-doctype="Communication"]:first').find(".content").html();
+					const doc = frappe.model.get_new_doc("Help Article");
+					doc.title = frm.doc.subject;
+					doc.content = content;
+					frappe.set_route("Form", "Help Article", doc.name);
+				});
+			}
+			frm.timeline.wrapper.data("help-article-event-attached", true);
+		}
 	},
 });
 
