Expand my Community achievements bar.

SOLVED

Reporting from custom workflow step

Avatar

Level 2

I have set up a series of custom workflow steps on AEM's DAM functions, that through OSGi link AEM assets to objects in a PIM system.

What I would like is an information report to be sent back and displayed within AEM once assets have been created/updated/deleted in the PIM. So it would display a report in a similar way to the product importer wizard, to show details of the assets that have been processed. The report could be sent as a notification to a user once the workflow is complete perhaps, but at the moment we are only notified on workflow failure, is there a way to extend this?

Can you advise how to send back information to the user to show error messages and 'success' messages from an OSGi service in a workflow? Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

How complicated is the result of success/failure? Are they too big to add to the comment field in the inbox?

To set the comment field for your dynamic particpant step add workItem metadata of name "comment".

try setting the comment like this:

workItem.getMetaDataMap().put("comment", "this is my comment");

If this is not enough you could take more drastic measures like changing the payload of the workflow to a console that you build, with a link to the item that was processed.  Another option might be to extend DAM to display this extra information.  I'm not an expert on DAM but from [0] it looks possible.  Maybe a combination of the comment and adding metadata to dam assets will satisfy the requirement? 

Hope this helps,

Will

[0] http://docs.adobe.com/docs/en/cq/current/dam/how_to_edit_metadata.html#Creating%20New%20Metadata%20P...

View solution in original post

5 Replies

Avatar

Employee

Hi,

Perhaps this is too simple, but you could just add a dynamic participant step at the end of your workflow and assign it to the person who started the workflow.  

There is a bit of a catch - if the workflow was started via a workflow launcher then the worklfow intiator is not the user who triggered the launcher.  You can retrieve the user who triggered the launcher by getting this meta-data entry:

workitem.getWorkflow().getMetaDataMap().get("userId");

If that value is set you should use it as the user to assign the step to.  If that value is un-set you can assume the worflow was started via a console and use the workflow initiator:

workitem.getWorkflow().getInitiator();

Hopefully that helps.

Will

Avatar

Level 9

Have you tried workflow notification

http://docs.adobe.com/docs/en/cq/current/administering/notification.html

If this doesn't satisfy your requirement, you might have to extend workflow and add custom function on completion/failure to send email notification

Avatar

Level 2

As I understand it, the participant step that sends an email allows you to report only on specific workflow functions.

I have written some bespoke code that hooks into a different system, and I would like to be able to report back to AEM how that has gone, and this is outside of the AEM workflow functions. So how can I send a report of successes/failures back into AEM - do you know if it's possible? When the code fails (for example with a null pointer exception), we get notified of the failure in Notifications. I'd like to extend this and have an informational report every time, even when the code doesn't fail. Either that or have an email notification that contains a report (but I don't think this is doable).

I appreciate your help.

Avatar

Correct answer by
Employee

Hi,

How complicated is the result of success/failure? Are they too big to add to the comment field in the inbox?

To set the comment field for your dynamic particpant step add workItem metadata of name "comment".

try setting the comment like this:

workItem.getMetaDataMap().put("comment", "this is my comment");

If this is not enough you could take more drastic measures like changing the payload of the workflow to a console that you build, with a link to the item that was processed.  Another option might be to extend DAM to display this extra information.  I'm not an expert on DAM but from [0] it looks possible.  Maybe a combination of the comment and adding metadata to dam assets will satisfy the requirement? 

Hope this helps,

Will

[0] http://docs.adobe.com/docs/en/cq/current/dam/how_to_edit_metadata.html#Creating%20New%20Metadata%20P...

Avatar

Level 2

Thanks Will, I will give the comment field a whirl.