Custom Delete Workflow for XFS and CFS | Community
Skip to main content
Level 2
May 6, 2025

Custom Delete Workflow for XFS and CFS

  • May 6, 2025
  • 2 replies
  • 538 views

We have a requirement to implement a custom delete workflow to handle the deletion of multiple XFS and CFS instances. As part of this process, the workflow should generate a single, consolidated notification indicating whether each asset was either deleted or locked.

Additionally, in cases where an asset is locked, we would like to explore the possibility of automatically re-triggering the workflow once the asset becomes unlocked.

Has anyone implemented a similar solution, or are there any best practices you could share?

2 replies

AmitVishwakarma
Community Advisor
Community Advisor
May 6, 2025

Hi @harshak11490245 ,

Custom Delete Workflow for XFS and CFS (with Lock Handling & Retry Logic):

Try below steps:

1. Custom Workflow Step

Create a Process Step that receives a payload list of XFS/CFS paths (could be passed via workflow metadata or fetched from a list node):

@Override public void execute(WorkItem workItem, WorkflowSession session, MetaDataMap args) throws WorkflowException { WorkflowData data = workItem.getWorkflowData(); List<String> assetPaths = getPathsFromPayload(data); Map<String, String> resultMap = new HashMap<>(); for (String path : assetPaths) { Resource res = resourceResolver.getResource(path); if (res == null) { resultMap.put(path, "NOT FOUND"); continue; } Node node = res.adaptTo(Node.class); if (node != null) { if (!node.isLocked()) { node.remove(); // or use assetManager.removeAsset() if in /content/dam resultMap.put(path, "DELETED"); } else { resultMap.put(path, "LOCKED"); addToRetryQueue(path); // Your retry mechanism } } } storeResult(workItem.getWorkflowData().getPayload().toString(), resultMap); }
aanchal-sikka
Community Advisor
Community Advisor
May 12, 2025

@harshak11490245 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Aanchal Sikka