Hi,
I have a requirement, if my resource is under any running workflow, i have to do some operations on resource and terminate running workflows on this resource. how do this programmatically?
Please let me know if any thoughts on this.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi All,
Thank you for all your replies.
I was expecting api to find running workflow instances based on the path. I found out this can be done in following way.
PayloadMap payloadMap = resolver.adaptTo(PayloadMap.class);
List<Workflow> workflowList = payloadMap.getWorkflowInstances(path, true);
Views
Replies
Total Likes
Do you mean if your resource is the Payload of the workflow? Typically to perform operations on a resource via a workflow - you can use the AEM APIS. You would use the Workflow API to create a custom workflow step. Then you can use other APIS - ie - Asset API if the payload was an asset.
Views
Replies
Total Likes
If you do not know how to create a custom workflow step, or use an AEM API within a workflow, or other workflow-related tasks - such as using an OR split - see this DEV doc - Adobe Experience Manager Help | Invoking an Adobe Experience Manager Custom 6.4 Workflow from a web ...
Views
Replies
Total Likes
Using ecmascript you can easily achieve this-
if
(workflowData.getPayloadType() ==
"JCR_PATH"
) {
var
path = workflowData.getPayload().toString();
var
node = jcrSession.getItem(path);
if
(node.getPath().indexOf(
"/content/we-retail/us/en"
) >= 0) {
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
Please check below link for more details-
Views
Replies
Total Likes
Hi All,
Thank you for all your replies.
I was expecting api to find running workflow instances based on the path. I found out this can be done in following way.
PayloadMap payloadMap = resolver.adaptTo(PayloadMap.class);
List<Workflow> workflowList = payloadMap.getWorkflowInstances(path, true);
Views
Replies
Total Likes