Boolean
-
4/26/2013 1:22:01 PM
How do I update a field when using DocumentEvents.Update.Before.
Hi all
I'm currently using the following global event:
DocumentEvents.Update.Before += MySite_Update_Before;
When I catch that event, there are a few fields I need to update when the user attempts to save the document (for example, there's a few fields that need to be marked as false depending on how the form was completed). I've run into two issues though:
1) If I use "node.SetValue("ValueToUpdate", false);", it updates the database but does not appear as changed in the CMS Desk. I suspect because we have versioning turned on it's still pointing to an older version.
2) To fix this, I attempt to call "node.Update()" or "DocumentHelper.UpdateDocument(document, tree, );", but this triggers my global event again, causing Kentico to spiral forever into an infinite loop.
So I guess my question is two part. One being, if I set a value in a global event, is there something else I need to do to get it to appear in Kentico? And two, if I need to call some sort of update on the node/document, how do I avoid Kentico getting stuck in a loop.
Thanks!
|