Automic Workload Automation

 View Only

Expand all | Collapse all

Scan folder to trigger workflow

  • 1.  Scan folder to trigger workflow

    Posted Jan 15, 2026 12:47 PM

    Hello guys !

    I was asked to implement a process that would trigger OA workflow if a file is available.  I created an EVNT.FILE object that scans the folder, now how can I get the file name that has been dropped, with is the input parameter to execute the workflow?  I searched the documentation, but couldn't find a working solution.  Can you please help me solve this ?

    Please note that English is not my primary language.  Please let me know if my request is not clear enough ;-)
    We are using V24.

    Thanks in advance for your help :-)



    ------------------------------
    [JobTitle]
    [CompanyName]
    [State]
    ------------------------------


  • 2.  RE: Scan folder to trigger workflow

    Posted Jan 15, 2026 01:51 PM

    The way we typically tackle this is to include code on the Event Process tab -- the part that gets triggered once the File Event finds something -- to do a PREP_PROCESS_FILENAME on the agent / file pattern in question.  Each matching filename is going to appear on its own row in that data sequence, so you can easily get the exact filename using GET_PROCESS_LINE to save it to a variable. (I gather there's presumably only one file to be found, but you probably want to consider how you want it to behave if it finds multiple matches.)   From there, you can just activate your target workflow, passing the filename variable.

    Let me know if you need additional help seeing how this works.

    -------------------------------------------



  • 3.  RE: Scan folder to trigger workflow

    Posted Jan 15, 2026 01:57 PM

    Thank you for the reply @Daryl Brown !  There may be at some point more than on file to process.  I will have to loop through them to get them processed.



    ------------------------------
    [JobTitle]
    [CompanyName]
    [State]
    ------------------------------



  • 4.  RE: Scan folder to trigger workflow

    Posted Jan 15, 2026 02:11 PM

    For multiple files, you may want to have the EVNT activate a FOREACH JOBP.

    -------------------------------------------



  • 5.  RE: Scan folder to trigger workflow

    Posted Jan 15, 2026 02:16 PM

    Never done that before ! I will have to make some research on the subject ;-)



    ------------------------------
    [JobTitle]
    [CompanyName]
    [State]
    ------------------------------



  • 6.  RE: Scan folder to trigger workflow

    Posted Jan 16, 2026 06:55 AM
    Edited by Mylene Chalut Jan 16, 2026 07:14 AM

    Good morning @Daryl Brown !

    I did what you suggested.  I added the following script in the Event Process section :

    :SET &HND# = PREP_PROCESS_FILENAME('WIN_WLA-PA1','\\fld6filer\BrsSystems\Workitems\TF22386\*.csv','Y')
    :PROCESS &HND#
    :   SET &LINE# = GET_PROCESS_LINE(&HND#)
    :   PRINT &LINE#
    :ENDPROCESS
     
    I executed the EVNT.FILE object and then added a file in the folder.  The status of the event stays in checking mode, but there is absolutely nothing in the report. I try adding and removing files from the folder...  nothing !

    This is pretty strait forward.  Can you see what's wrong with this ?
    Here is the content of the File Event section :

    -------------------------------------------



  • 7.  RE: Scan folder to trigger workflow

    Posted Jan 16, 2026 09:55 AM

    Hmm...  If the event shows a status of 'checking', that suggests to me it's getting hung up on the File Event part of the task, not the Event Process part.

    Some thoughts:

    • If you look at your event executions (or !EVNT executions, if there are any) show anything in their report to indicate what they're doing?  This might be in the Logging report, if there is one.
    • You're not specifying a filename pattern in your path.  Could you try adding '*.csv' at the end to see if anything changes?  (I'm not entirely clear from the documentation whether it's necessary, but it can't hurt to try.)
    • You're using a UNC path, and we've sometimes run into problems doing that if the user you're executing it as doesn't have permissions to the folder.  So first off, on the event's Attributes tab, are you specifying a Login object?  (If no, try adding one.)
      • To further test to see if the UNC path is the issue, could you try testing out this event (or a similar one) against a path on a local drive to see if it behaves properly?
    • I haven't experimented with the 'File changed' setting myself...it's possible that's not behaving the way you expect it to.  In our case, we are typically monitoring incoming file folders, and we use file events like this to kick off workflows to move those files elsewhere, so that the folder we're monitoring is always empty except when new files arrive.  So in this light, we really only need to look for the Number of files >= 1, which is a bit less processing-intensive than what you're specifying here.  (Besides, if you're literally only looking to identify new files in this folder, then the PREP_PROCESS_FILENAME you're using on the Event Process tab may not produce the desired effect, as it will build a complete list of files in that folder, not merely the new ones.)

    Let me know if that helps at all!

    -------------------------------------------



  • 8.  RE: Scan folder to trigger workflow

    Posted Jan 16, 2026 11:33 AM

    I modified my script as follow :

    :SET &PATH# = "\\fld6filer\BrsSystems\Workitems\TF22386\"
    :SET &HND# = PREP_PROCESS_FILENAME("WIN_WLA-PA1","&PATH#\*.csv","Y","N",,,"UC_LOGIN=LOGIN.SERVICEACCOUNT.BR.BPMS")
    :PROCESS &HND#
    :  SET &LINE#=GET_PROCESS_LINE(&HND#)
    :  PRINT &LINE#
    :ENDPROCESS
    :SET &RUNID# = ACTIVATE_UC_OBJECT(JOBP.WIN.BR_OA_UTILITY_TEST)

    And the File Event as follow :

    • If you look at your event executions (or !EVNT executions, if there are any) show anything in their report to indicate what they're doing?  This might be in the Logging report, if there is one.  No reports at all.  No information under the Details section either
    • You're not specifying a filename pattern in your path.  Could you try adding '*.csv' at the end to see if anything changes?  (I'm not entirely clear from the documentation whether it's necessary, but it can't hurt to try.)  Tried that !
    • You're using a UNC path, and we've sometimes run into problems doing that if the user you're executing it as doesn't have permissions to the folder.  So first off, on the event's Attributes tab, are you specifying a Login object?  (If no, try adding one.)
      • To further test to see if the UNC path is the issue, could you try testing out this event (or a similar one) against a path on a local drive to see if it behaves properly?  I executed another job that writes to that drive and it's working as expected.
    • I haven't experimented with the 'File changed' setting myself...it's possible that's not behaving the way you expect it to.  In our case, we are typically monitoring incoming file folders, and we use file events like this to kick off workflows to move those files elsewhere, so that the folder we're monitoring is always empty except when new files arrive.  So in this light, we really only need to look for the Number of files >= 1, which is a bit less processing-intensive than what you're specifying here.  (Besides, if you're literally only looking to identify new files in this folder, then the PREP_PROCESS_FILENAME you're using on the Event Process tab may not produce the desired effect, as it will build a complete list of files in that folder, not merely the new ones.)  The processed files will be removed from the folder after the job succeeds.  But now I am just trying to get the event to return the file name.  

    I don't understand why this is not working !  I added the script in a JOBS.WIN object and it's working (???).  The issue is with the File Event setup...



    ------------------------------
    Thank you,
    Mylene Chalut
    ------------------------------



  • 9.  RE: Scan folder to trigger workflow

    Broadcom Employee
    Posted 27 days ago
    Hi Mylene,
    Broadcom Support has identified the behavior you are observing as a bug. We are in the process of preparing a fix for the issue.
    The following KB article describes the issue in more detail:
    The issue will likely be fixed in the next version, although I cannot guarantee this at the moment.
    As a workaround and for testing purposes you can try:
    • using a path without asterisk to see if a file get picked up
    • running the Event against a C-based Agent (e.g. Windows Agent v21.0.15), which does not show this behavior.
      (this version is not supported anymore so you would have to wait for the fix before moving this into Prod)
    Please subscribe yourself to the KB article to be kept in the loop about the release of the fix.
    -------------------------------------------



  • 10.  RE: Scan folder to trigger workflow

    Posted 25 days ago

    @Michiel Verhoeven,
    Thank you for the information.  I tried removing the asterisk and it is still behaving the same.  
    What I have now 
    PROCESS
    :SET &PATH# = "\\fld6filer\BrsSystems\Workitems\TF22386"
    :SET &HND# = PREP_PROCESS_FILENAME("WIN_WLA-PA1","&PATH#\*.csv","Y","N",,,"UC_LOGIN=SERVICEACCOUNT")
    :PROCESS &HND#
    :  SET &LINE#=GET_PROCESS_LINE(&HND#)
    :  SET &LENGTH# = STR_LENGTH(&PATH#)
    :  SET &CHECK# = STR_ENDS_WITH(&PATH#,"\")
    :    IF &CHECK# EQ "Y"
    :      SET &LENGTH# = &LENGTH# + 1
    :    ELSE &CHECK# EQ "N"
    :      SET &LENGTH# = &LENGTH# + 2
    :    ENDIF
    :  SET &FILENAME# = SUBSTR(&LINE#, &LENGTH#)
    :ENDPROCESS
    !:SET &RUNID# = ACTIVATE_UC_OBJECT(JOBP.WIN.BR_OA_UTILITY_TEST)

    The process itself is working if I add it in a JOBS.WIN object.  I guess the only option that I have at the moment is to create an EVNT.TIME object to trigger the JOBS.WIN object ? Do you think that would be a good idea ?



    ------------------------------
    Thank you,
    Mylene Chalut
    ------------------------------



  • 11.  RE: Scan folder to trigger workflow

    Posted 25 days ago

    I know I asked this before, but I didn't see your answer...  On your event object, are you specifying a login object on the attributes tab?  (You don't necessarily need a login object for file events, but if you're not using one, then it might be getting stuck trying to access the share without specifying any login credentials.)

    Another thing to try...  on the event tab, if you toggle the 'File' condition from 'File Changed' to (blank), does that work any better?

    -------------------------------------------



  • 12.  RE: Scan folder to trigger workflow

    Posted 25 days ago

    @Daryl Brown : I do have a login object in the attributes tab...  and...
    YEAH !!!  I removed "File Changed" and it's working !!  Finally !!
    Thank you so much !
    Now I have to figure out the loop ;-)
    Have a nice day !



    ------------------------------
    Thank you,
    Mylene Chalut
    ------------------------------