Can I tell if Document is being created from one section/tree or another?
Hi folks,
I'm using events to additionaly handle Document creation.
At the other part of the system, I also call Document.CreateNew(..) mehtod, but this time I dont want it to be handled with the above delegate.
Unluckily, docType I am creating is also the same, so I can't tell if I want to execute custom handler or not.
Is there a way to distinguish if an admin is creating Document using Content tree action or any other custom tree action or logic?
I guess it should be somehow possible since you have to derive from AplicationBase to name the event handlers, which allows you to override app Alias, and other app properties, but dont know how to use them... :{}
To follow up on Sjors comment, you could create a specific "worker" user which you use in your custom events, rather than user 0 or the document creator. This would let you identify whether the document was created through the admin UI or a back end process. So when handling an event you only want executed for admin UI initiated events, check that the user was not the "worker" user.
There's no property of a Document which is set (OOB) that indicates where it was created. As others have said you could create a specific user which is used for your custom creating method.
The only other way would be to check the Call Stack in the event handler and check where it came from.
Can I tell if Document is being created from one section/tree or another?
Hi folks,
I'm using events to additionaly handle Document creation.
At the other part of the system, I also call Document.CreateNew(..) mehtod, but this time I dont want it to be handled with the above delegate.
Unluckily, docType I am creating is also the same, so I can't tell if I want to execute custom handler or not.
Is there a way to distinguish if an admin is creating Document using Content tree action or any other custom tree action or logic?
I guess it should be somehow possible since you have to derive from AplicationBase to name the event handlers, which allows you to override app Alias, and other app properties, but dont know how to use them... :{}
Can't you make a check in the event handler to see who's creating it?
To follow up on Sjors comment, you could create a specific "worker" user which you use in your custom events, rather than user 0 or the document creator. This would let you identify whether the document was created through the admin UI or a back end process. So when handling an event you only want executed for admin UI initiated events, check that the user was not the "worker" user.
-Chris
There's no property of a Document which is set (OOB) that indicates where it was created. As others have said you could create a specific user which is used for your custom creating method.
The only other way would be to check the Call Stack in the event handler and check where it came from.
is working on a reply...