Is it possible to detect which event triggered a folder rule?

cancel
Showing results for 
Search instead for 
Did you mean: 
pedwards99
Partner

Is it possible to detect which event triggered a folder rule?

Hi there,

I have a rule on a folder that executes some custom javascript.

The rule is triggered:

"When items are created or enter this folder"

and

"When items are updated"

I want my script to behave slightly differently for each event.

Does anyone know if it is possible to detect which event triggered the script or do I need to create 2 separate rules and scripts?

Thanks

Paul

4 Replies
mehe
Senior Member II

Re: Is it possible to detect which event triggered a folder rule?

Hi Paul,

I don't think there is a handle or something else for the triggering event, but you can set/check a special property on the triggering object. For example a document action triggers the event,

  • test if your property or aspect is already set
  • if not - it's a new doc (meaning onCreate event), so set your property
  • if already set it's a update/change event

you could also check the modified an created date time - if modified is newer than created, it was a update/change event. (if created is newer than modified, shut down your whole network Smiley Happy )

Maybe thats more work than to handle two separate events... but...

regards,

Martin

douglascrp
Advanced II

Re: Is it possible to detect which event triggered a folder rule?

Or another option would be to use behaviors instead, and then you will be able to detect what caused the execution, and even more details like, the properties that got changed, including the before and after values.

pedwards99
Partner

Re: Is it possible to detect which event triggered a folder rule?

Thanks Martin

pedwards99
Partner

Re: Is it possible to detect which event triggered a folder rule?

Thanks Douglas