Hi,
I want to restrict the AEM page to be subjected to workflow to only once. Means if I have started the workflow for a particular page I should not be allowed to start any other workflow until the workflow is completed/aborted. I can see this is happening in classic UI by default but in touch ui I was able to start multiple workflows at a time in workflow . How can I restrict in Touch Ui so that if once user starts the workflow no other user or himself can start the workflow until previous workflow is aborted/completed. Please note I am working in AEM 6.3
Thanks in Advance
I'd be keen to know this also. Has anyone managed to get this to work? I think this is customisation...
Views
Replies
Total Likes
By default - you can only have 1 workflow running on a given page.
Views
Replies
Total Likes
We are finding that not to be the case. I just verified that too on a 6.3 SP2 instance on my local machine. Some of the others have tested this on 6.3 SP1. Have a look at the attached screenshot that shows the community page is being workflowed twice.
Thoughts?
Views
Replies
Total Likes
YOu are correct -- from the Classic UI - you can only subject a page to 1 workflow --
But in Touch UI - this is not the case. I will check with the team why these behaviors are not consistent.
Correct. That appears to be the case. I feel in general, there is a case that a page, at the very least, not being subject to multiple running workflows. That should be pretty simple to implement in Touch UI. It gets interesting when we talk about a workflow package where multiple resources are involved. Implement this kind of simple control for a package is that one could have multiple packages where the same resources participate. As you can imagine, with it being possible to subject a "page" to multiple workflows simultaneously is causing challenges to our authors. Our finding shows the following:
Shall we raise this as a bug with Daycare?
Thanks,
Arup
Views
Replies
Total Likes
I just talked to the Workflow Eng team. There is no restriction at the Workflow level. The restriction we see in the Classic UI is at the UI level. So Classic has it and Touch UI does not. As far as the AEM Workflow engine is concerned - it can have the same page as payloads in multiple workflows. Hope this clears it up.
Thanks for the clarification. What is the use case for it from an "approval" point of view? Surely the end goal, for majority of the use cases, is to have several stages of reviews followed by activation to publish instance(s). What benefit could there possibly be in having multiple workflows for the same page? I just do not see the merit of it... What is your view?
Views
Replies
Total Likes
Personally - I agree. You raise valid points - if you are routing a page through a workflow - there should only be 1 page.
Hi,
There is a way to identify whether page is part of workflow or not.
On click of create workflow , you can call js which check the workflow status using 'resource-status'
e.g. for content/AEM63App/fr
http://localhost:4502/resource-status/editor/content/AEM63App/fr.1.json
If page is part of workflow it returns response something like below:
{"0":{"statusType":"workflow","statusPriority":10000,"shortMessage":"demo-email","variant":"info","i18n.message.snippets":["demo-email"],"title":"Workflow","message":"This page is subject to the workflow <i>{0}<\/i>"}}
based on response you can stop further processing to go on launch workflow screen and return error using coral alert dialog.
I didn't try this but It can be feasible.
Thank you Arun. That certainly seems feasible. I still think this could be and should be a configurable behaviour within AEM. But yes, meanwhile, I think one has no option but to customise.
Views
Replies
Total Likes
So I gave a try for this. I am bad in Jquery. Would love if somebody good at Jquery or UI can fix this . I tested this in browser console and it prevented a new workflow from initiating. Thanks to arun for the hints.
$(function() {
console.log("ready!");
var obj = $("button[title|='Start Workflow']");
var path = obj[0].dataset.path;
console.log(obj[0].dataset.path);
path = "/resource-status/editor" + path + ".1.json";
console.log("path is " + path);
var start = $(".js-cq-WorkflowStart-submit.coral3-Button.coral3-Button--primary");
console.log(start);
start.click(function(event) {
//event.preventDefault();
event.stopPropagation();
// Do something
alert("clicked");
$.get(path, function(data) {
$(".result").html(data);
console.log(data);
//var jsonObject= JSON.stringify(data); var count = JSON.parse(jsonObject).length;
length = Object.keys(data).length;
if (length > 0) {
var dialog = document.querySelector('.js-cq-WorkflowStart');
console.log(dialog)
dialog.hide();
var dialog = new Coral.Dialog().set({
id: 'myDialog',
header: {
innerHTML: '<coral-alert-header>Workflow cannot be started</coral-alert-header>'
},
content: {
innerHTML: '<coral-alert-content>Workflow cannot be initiated as the page has an active workflow already running. <br> Please complete the workflow before starting a new one</coral-alert-content>'
},
footer: {
innerHTML: '<button is="coral-button" variant="primary" coral-close>Ok</button>'
}
});
document.body.appendChild(dialog);
dialog.show();
}
});
});
});
here you go:
create clientlibs with category 'cq.gui.coral.common.admin.timeline'
aem63app-repo/wfcheck.js at master · arunpatidar02/aem63app-repo · GitHub
Above code will check workflow initiation when you click from site console. This works for multipage as well.
The alert will show the page with workflow name and workflow instance's CRXDE location(if available) to help to locate workflow.
Note : Veena_07 shared the code which created to trigger check when you start workflow from page settings, similar code(or code reference from Veena ) can be written if want to restrict workflow for here as well.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies