Cannot retrieve information about the triggered event from neither the MonitorEvents or FileChangeTrigger activities



I am attempting to simply get information about what folder/file has changed using a FileChangeTrigger. The GetEventInfo seems to be the correct thing to use but when I create a variable of type EventInfo and attempt to pull information from it, I keep getting Null Reference Exceptions. What is the correct way to use GetEventInfo to retrieve information about what has changed as a result of using a FileChangeTrigger.




So the File Change Trigger was not working for us because the File Change Trigger simply doesn’t tell you any information about the FileSystemEvent that occurs. We simply want the FullPath of the FileSystemEvent so that we can tell what has changed (i.e. what has caused the trigger to be invoked). It seems to me that the authors of the activity didn’t consider this and designed it solely as a “monitor” that would subsequently run activities as a result of the trigger. Sort of like a “kick-off” event if you will. Never considering that a consumer of the activity might want to know information about the “kick-off” event itself.

The Monitor Events/File Change Trigger activities simply do not return any information about what has changed. When I decompiled the code I could see that a simple change in the UiPath.Core.Activities.FileChangeTrigger class might do the trick. It seems to me that instead of having this class inherit from NativeActivity, it should instead inherit from NativeActivity<TResult> where TResult could be the “object args” being sent to the Event_Trigger method. Again, all of this could be avoided if you design the activity to return information about the triggered event.

In order to get this to work I decided that it was best to create a custom Windows service that monitors the source folder for newly created files. Let’s call this folder “Source”. When a user drops a PDF file anywhere within the “Source” folder, the service uses the FileSystemWatcher class to determine what has been created. It takes the path and writes it to a file within another folder called a “Queue” folder. So for every change, there’s a file created in the “Queue” folder that simply gives the path to what file has been created in the “Source” folder.

Now, in UiPath, I use the File Change Trigger activity to monitor the “Queue” folder. When a new file is added to the “Queue” folder, that file is opened and the path to what was created in the “Source” is extracted for future workflows to utilize.

I’ve made mention of this to key people within UiPath and I hope to get support for this to be added in the next release. Please up vote this request so this can be added in the next release.