Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

WatchedFolder - filename dependency

Avatar

Level 6

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,

1 Accepted Solution

Avatar

Correct answer by
Level 5

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/watche...

 

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:

Screen Shot 2022-08-09 at 3.56.41 pm.png

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

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 5

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/watche...

 

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:

Screen Shot 2022-08-09 at 3.56.41 pm.png

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