Hot answers tagged

7

In Sitecore 9 the event model has changed somewhat and events are now queued within each DB (master, core, web etc). This is partially correct. You could always queue remote events in your Sitecore database of choice. Sitecore 9 still has a concept of a preferred event queue database. Two options for queueing a remote event Sitecore.Eventing....


5

Answer In your specific use case, Publishing is the Sitecore function that you are interested in. Therefore, I would create a Helix Module called Foundation.Publishing on the Foundation Level, and then add your Event Handler and associated patch configs there. Background Generally speaking, customizations to Sitecore should be contained with the module ...


3

I would use item:created event handler, because this is only fired once, when the item is published. (Publish creates the item in web database). It isn't fired multiple times, even if you create a new version from the item or republish the item instead of smart publish. public void OnItemCreated(object sender, EventArgs args) { Item item = ((...


3

I would recommend creating an item:saved event handler to take the data and save the information you need. Note: the item:saved event is different from the item:saving event and I believe preferable in this case because the item:saving event happens while the editor waits for the save command to complete. Create a custom event handler public class ...


2

You can achieve this by programmatically moving the bucketed item to the root of the bucket with the BucketManager. Doing this will force it to reevaluate the bucket rules and reorganize it: BucketManager.MoveItemIntoBucket(bucketedItem, bucketItem); In our solutions, we typically create an item:saved event handler to do this automatically: using Sitecore....


2

Can't say I've had to do this, but firing up my friend ILSpy, I've got a few ideas for you: You can open Sitecore.Kernel and find IEventQueue and "analyze" the QueueEvent() method to find places it's used in real code. That lets me find this code: private Handle QueuePublish(DistributedPublishOptions[] options, Language clientLanguage) { Handle handle ...


1

Any event handler has to follow a few conventions: The class must have a method that accepts two parameters and return void: object - represents the object that holds a collection of the various event listeners EventArgs - holds the parameters being passed to the event handler For your case, if you added the following event handlers for the ...


1

What are Events in Sitecore? The best description of what Events are would probably be the one provided by Sitecore: Events track visitor activity on a website. Tracking events helps build up a more complete picture of a visitor’s behavior as they navigate your website. You should assign engagement value points to all events to reflect their relative ...


1

I have not practically use the Events as much but from the definition and research, I am writing this answer hopefully it will clear your doubts. An event is anything significant that occurs within the context of an interaction, such as viewing a web page or making a purchase in a physical store. When an event is triggered, an event definition ID is ...


1

You can create "Code Beside" pages in ASPX/C# that embeds a small amount of code. We sometimes need to see which Solr cores are connected where (when troubleshooting) as we version our Solr with each new release. To do that we use Azure's "App Service Editor" to open an in-browser VS Code instance pointed at the running production site. WARNING: Yes, ...


1

You can get this information using reflection mechanism and internal item.GetChanges(true) method: Get ItemChanges by executing GetChanges(true) with reflection Get FieldChanges from ItemChanges. Get underlying _field field from every FieldChange with reflection again Check if any of the fields has ResetBlank flag set to true. Code: public class ...


1

The answer to my original question could have worked as Mark suggested, by looking at Context.Site.Name during the onSaving event, but then I tried to go with the best practice and use UISaved pipeline, as it triggers only when the Sitecore user "Saves" from within the Sitecore Content editor, so that worked perfectly for my case. I was trying to change my ...


Only top voted, non community-wiki answers of a minimum length are eligible