Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to programmatically control the status of Uploaded Asset?

Avatar

Level 4

We have a custom Workflow where it move the asset from one location of the dam to other. Once after the move even workflow Status is completed. Asset Status would display as "In workflow" not "New"

mrudul_0-1643305339624.png

Added purge event for workflow payload after the completion of the process. Still no go. 

Any idea how to get rid of "In workflow" Status?

Workflow workflow = workItem.getWorkflow();
String workflowId = workflow.getId();
Dictionary<String, Object> properties = new Hashtable<>();
properties.put("EventType", "WorkflowPurgedEvent");
properties.put("WorkflowInstanceId", workflowId);
properties.put("payloadPath", runPath);
Event event = new Event("com/adobe/granite/workflow/event_purge", properties);
eventAdmin.postEvent(event);

Regards, 
Mrudul

6 Replies

Avatar

Community Advisor

Hi,

 

Can you check whether "Handler advance" is checked for all the process step in your workflow to proceed to "Flow End"? 

Also, add deactivate method to your process implementation class with empty block and check.This should complete entire service life cycle.

Avatar

Level 4

Hi @Ravi_Pampana - Thanks for the suggestion. 
Yes, handler Advance is checked for all the Process steps in the workflow. 
What is that deactivate method you are talking about ? Could you please give more insight on this?

Avatar

Employee Advisor

Hi @mrudul ,

 

Generally, this shows up when the workflow is still doing some job on the asset. Have a look at the Archives and Failures in workflow console.

 

This will give you idea that what task is still in progress, and you can achieve them programatically by steps mentioned by Ravi.

Please keep us posted if it does not work for you.

Thanks

Avatar

Level 7

HI @mrudul ,

some question to clarify the issue:

1. It was working fine before the introduction of the purge event?

2. Are you facing some error into the error log

 

This kind of error could happens also in case you didn't "finish" the workflow instance into your code, since as far as I understood you are talking about a custom implementation.

So, it will be useful if you can share the javaclass where you are doing this activites.

Thanks,

Antonio

Avatar

Level 4

Hi @antoniom5495929  @milind_bachani  @Ravi_Pampana ,

Just to add on to this. We dont see any workflow instances running and only the status is showing as in workflow. Do we need to set any property to show it as new?

Avatar

Community Advisor

@mrudul have you resolved this issue?

Are you closing all the newly created/open objects propely ie, session, resourceResolver?

are you getting this message for all the uploaded assets and asset types (jpg,pdf) or for any particular asset?

Are you sensing anythig in the logs, can you share the logs if issue still persits?