WatchedFolder - filename dependency | Community
Skip to main content
crich2784
Level 6
August 8, 2022
Solved

WatchedFolder - filename dependency

  • August 8, 2022
  • 1 reply
  • 521 views

We have a process being kicked off by a watched folder.  Unfortunately, we are not guarunteed that the filename will be "data.xml" (or whatever else).  However, because we are referring to it in the workflow, it doesn't make it very portable.  

 

I see that it's setting this in the metadata:

com.adobe.aemfd.watchfolder.sourceFileOrDir : C:\ReviewRackProcess_WatchedFolder\stage\Wxc2679dcb579a18455c19d803\data.xml

I guess I need to dynamically read the filename and retrieve the XML in to a variable - probably a custom step.

 

Anyway, if anybody has already solved this, let me know.

 

Thanks,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Nikhil_Verma

You are right, it seems there isn't a way to get the file name in the workflow without custom code.

 

A more elegant way is to create a custom Payload Mapper Filter to map the structure of the watched folder to the workflow payload. Read here for more details: https://experienceleague.adobe.com/docs/experience-manager-65/forms/publish-process-aem-forms/watched-folder-in-aem-forms.html?lang=en#create-payload-mapper-filter-to-map-structure-of-a-watched-folder-to-the-payload-of-a-workflow

 

But the above could be an overkill for light weight use cases, and just extracting the file name with a little custom code would be a faster way. You can extract file name of the input file using ECMA script in AEM workflow:

And then refer this script in the 'Process Step'.

 

 

1 reply

Nikhil_Verma
Nikhil_VermaAccepted solution
Level 4
August 9, 2022

You are right, it seems there isn't a way to get the file name in the workflow without custom code.

 

A more elegant way is to create a custom Payload Mapper Filter to map the structure of the watched folder to the workflow payload. Read here for more details: https://experienceleague.adobe.com/docs/experience-manager-65/forms/publish-process-aem-forms/watched-folder-in-aem-forms.html?lang=en#create-payload-mapper-filter-to-map-structure-of-a-watched-folder-to-the-payload-of-a-workflow

 

But the above could be an overkill for light weight use cases, and just extracting the file name with a little custom code would be a faster way. You can extract file name of the input file using ECMA script in AEM workflow:

And then refer this script in the 'Process Step'.