I have a workflow setup where a user submits a page for review/approval. The approver needs to be able to terminate/end the workflow and send a notification email to the initiator (NOT assign the workflow back to the initiator - it needs to end altogether) with a comment on why they terminated the flow.
I have the "terminate and send email" aspect working fine with a Send Email step that sends an email and auto-advances to Flow End. However, I need to include the approver's comment from the "Complete Work Item" dialog in the email and I cannot figure out the variable that I need to put in the email template.
${data.startComment} or ${instance.data.startComment} retrieves the comment entered on initial workflow kick-off, but how do I get the comment from the completion dialog?
This value I need seems to get stored deep in the workflow instance node hierarchy under /etc/workflow/instances/*date*/model_***/history/****/workItem/metaData with a "comment" property there, but no variable I've tried has succeeded in pulling that in.
Thanks for any help.
Solved! Go to Solution.
You can create a custom workflow step to get this value using the JCR API. That way -- you custom step can pull in any value that you need.
You can create a custom workflow step to get this value using the JCR API. That way -- you custom step can pull in any value that you need.
From 5.5 onwards you can't pull using a variable. The issue has been filled & The internal reference of this request is CQ-5554.
For now follow the scott recommendation to use jcr api with custom step.
Use WorkflowSession API to get the session.getHistory(workflow). it will return all the data used in workflow
Thanks,
Vikram
Views
Replies
Total Likes
I also have the same use case. We are using CQ5.5.2. Is this issue resolved. Do we have any hotfix for this ??
Views
Replies
Total Likes
Nope. use alternative
Thanks Sham for the reply. Few more queries
1) Is it possible to get the approver's user name or user id in the mail. something like ${approver.userid} or ${approver.username}.
I looked in the documentation but couldn't get any variable which gives me these values. Is it also possible only through custom service ?
2) I am using the Page Activate service in the workflow to activate the page once it is approved by the approver but it only activates the page, it doesn't activate the DAM assets associated with the page.
Someone in the forum suggested to check the Scheduled Page/Asset Activation workflow but it also uses the same service and doesn't activate the page assets, only activates the page. Any inputs on this ?
Views
Replies
Total Likes
1) Documentation is up to date
2) AFAIK it is not true.
Views
Replies
Total Likes
Hi,
Create a custom workflow for Page and Asset activation,
Node n = adminSession.getNode(pagePath+"/jcr:content");
AssetReferenceSearch ref = new AssetReferenceSearch(n,DamConstants.MOUNTPOINT_ASSETS,resourceResolver);
Map<String,Asset> allref = new HashMap<String,Asset>();
allref.putAll(ref.search());
for (Map.Entry<String, Asset> entry : allref.entrySet()) {
String assetPath = entry.getKey();
log.info(assetPath+"<br>"); // Path of all Asset ref in page
log.info(assetPath +" ASSET ACTIVATION STARTED");
replicator.replicate(adminSession, ReplicationActionType.ACTIVATE, assetPath);
log.info(assetPath +" ASSET ACTIVATION ENDED");
}
log.info("PAGE ACTIVATION STARTED");
replicator.replicate(adminSession, ReplicationActionType.ACTIVATE, pagePath);
this will activate page and all the assets on the page,
Thanks,
Vikram
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies