Expand my Community achievements bar.

AEM 6.5.10 - Start Workflow on Site Pages in Omni Search Results | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

AEM 6.5.10 - Start Workflow on Site Pages in Omni Search Results by Sreekanth Choudry Nalabotu

Abstract

1) Create a clientlib /apps/eaem-omni-search-create-workflow with categories=cq.gui.common.admin.searchpanel and below code to add the workflow button in search action bar...

(function ($, $document) {
const FOUNDATION_CONTENT_LOADED = "foundation-contentloaded",
GRANITE_OMNI_SEARCH_CONTENT = ".granite-omnisearch-content",
SITES_EDIT_ACTIVATOR = "cq-siteadmin-admin-actions-edit-activator",
START_WF_URL = "/mnt/override/libs/wcm/core/content/common/startbulkworkflows.html",
CREATE_WF_BUT_URL = "/apps/eaem-omni-search-create-workflow/create-wf-but.html";

let init = false;

$document.on(FOUNDATION_CONTENT_LOADED, GRANITE_OMNI_SEARCH_CONTENT, function(event){
$.ajax(CREATE_WF_BUT_URL).done(function(html){
init = addCreateButton(html);
});
});

function addCreateButton(html){
html = html || "";

if(!html.trim()){
return;
}

const $eActivator = $("." + SITES_EDIT_ACTIVATOR);

if ($eActivator.length == 0) {
return false;
}

let $createWFBut = $("" + html + "")
.insertBefore($eActivator.closest("coral-actionbar-item"));

$createWFBut = $createWFBut.find("button");

$createWFBut.click(startWorkflow);

return true;
}

function startWorkflow(){
const $selectedItems = $(".foundation-selections-item");

if($selectedItems.length == 0){
return;
}

let startWfUrl = START_WF_URL + "?"

$selectedItems.each(function(){
startWfUrl = startWfUrl + "item=" + $(this).data("graniteCollectionItemId") + "&";
})

window.open(startWfUrl, '_blank');
}
})(jQuery, jQuery(document));


2) Create button /apps/eaem-omni-search-create-workflow/create-wf-but with the following config...






Read Full Blog

AEM 6.5.10 - Start Workflow on Site Pages in Omni Search Results

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
0 Replies