Hot answers tagged

19

I believe the primary reason is each event has an associated target database. Found a brief explanation here by Kiran Patils on how the event queuing works: The CM instance triggers an event such as "publish:end:remote". The triggered event is added to the EventQueue table in the database that is targeted by the event. For example, the publish:end:remote ...


16

Ok - for attaching code to when the application starts, you have a couple of options. Initialize Pipeline The standard way to do this is via the Initialize pipeline. Create yourself a new processor class. It does not need to inherit from anything, but must have a public method called Process that takes a PipelineArgs object. Example: public class ...


15

The problem with Sitecore.Context.Site: Sitecore performs publishing on the publisher site, and as you noted, the publish:end is an event and is called without a request, so there isn't even a URL to work from. Based on the above, hypothetically, if we assume that Sitecore is going to resolve a site (we don't know which yet) to put in the Sitecore.Context ...


14

This is how you could use the using statement inside Powershell function Using-Object { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [AllowEmptyString()] [AllowEmptyCollection()] [AllowNull()] [object] $InputObject, [Parameter(Mandatory = $true)] [scriptblock] $...


13

Yes you can. In this post http://ggullentops.blogspot.be/2016/02/integrating-addthis-with-sitecore-goals.html I described how you can trigger a goal from AddThis (so actually using javascript to call a controller). A snippet from the controller code: var goalItem = ... // get goal item from Sitecore var visit = Tracker.Current; var page = Tracker.Current....


13

Sitecore's built in disablers, like the SecurityDisabler and the EventsDisabler classes, all inherit the Sitecore-provided Switcher class. This class is an IDisposable that can be used to create disablers for use in both pipeline processors and event handlers, without issue. The Switcher class is easy enough to implement, but I have written a more readable ...


9

There are two ways to register goals from JavaScript that I am aware of: Federated Experience Manager Sitecore FXM allows you to make visits and trigger events from external websites. There's an FXM feature (that is not commonly used), allowing you to combine simultaneous site visits from the same browser into a single interaction. Visits will be combined ...


9

Pipeline To me pipelines are about process. Do this, then this. Allowing you to insert and remove processes simply with patch configs. A great example of this is login user pipeline. Your pipeline would be: Log user in Identify user in xDB Add logging info for user Add user to marketing automation for returning customer etc.... It is a process flow that ...


8

Answer All databases have an [EventQueue] in order to help spread out responsibilities and reduce the load on a particular database. Explanation The [EventQueue] table exists as a means of communication among all web servers that connect to it. One web server can queue an event in any database it has access to. This event is then read by any other web ...


8

Wrapping your code in a BulkUpdateContext block as mentioned in the Powershell GitBook will make the tasks more performant and also silence any events or tasks. Import-Function -Name New-UsingBlock New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { # insert cleanup code here... }


7

If you decompile and have a look at the Sitecore.Data.Items.ItemEditing class, in Sitecore.Kernel, you will find that all the EndEdit(bool) method does (and the relevant parts of its overload methods do) is essentially wrap the the call to ItemManager.SaveItem with an EventDisabler. Solution 1: To apply the same technique in order to make sure that your ...


7

Because Sitecore does not provide you the hooks to validate the transaction you're after, your best bet is to hide the security features and manage them in code. Here's a few suggestions that aren't too onerous to implement. Prerequisite: Lock Sitecore Users out of Security Features Make sure no one has access to Sitecore Client Securing Make sure no one ...


7

The event queue table has two columns related to the matter. They are RaiseGlobally (true by default) and RaiseLocally (false by default). These flags control the event execution appropriately (i.e. if RaiseGlobally is false, the event will not be processed by remote servers) In order to control those flags, you can use the second overload of the ...


7

There's no pipeline or event that you can plug into in the general sense of Sitecore's pipelines and events that you see in the ShowConfig. Instead, it's driven by an Item based pipeline provider. This is accomplished by creating what's called Workflow Actions that allows you to execute code when a workflow is changed to that state. There's an example of ...


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....


6

You can do this using Sitecore's eventing engine, by creating event handlers for the roles:usersAdded event, the roles:usersAdded:remote event, or both. The roles:usersAdded event is raised when users have been added to one or more roles on the environment. In other words, if you have a single-server environment then this is the event that you will want to ...


6

After having processed an event from the queue each instance updates the associated last processing timestamp (LPT) which is stored in the Properties table and has the key in the following format 'EQStamp_{Sitecore-Instance-Name}' Therefore, you can use the LPT to filter out events which have already been processed by a given instance - literally just the ...


6

The item:created event will come too soon as the fields will not be populated yet (as you have noticed). The item:saved event will do the trick, but created overhead as it is called on every save (so it works, but you really don't want to take that hit). There is an item:added event that could help. I've used this one before and it works, but apparently ...


5

In order to be 100% sure that a particular event was processed by all servers, you would need to write a rather complex query. To illustrate, I've written a query to return all events processed by a single web server: SELECT * FROM [EventQueue] where [Stamp] <= ( select Cast(CONVERT(nvarchar(100), [Value]) as int) from [Properties] where [Key] = ...


5

When an item is updated in the index, the indexing:updateditem event is raised with the index name and item ID as parameters. You could add a handler for this event and either clear the cache based on that item, or append to a queue that you then process and clear when the indexing:end event is fired. There is also indexing:deleteitem and indexing:added for ...


5

There are actually a few options here: Command Templates Event handlers (item:added) Pipeline processors (uiAddFromTemplate, addFromTemplate) Command Templates This is by far the simplest solution, requiring the least implementation effort but is also the least extensible and flexible. What you would do is create a command template item under the branch ...


5

This works because of the way that HtmlCacheClear processes the <sites> list. When you take a peek into the code for HtmlCacheClearer.ClearCache() method, you'll see that it's iterating through the list of sites in a basic for() loop. Therefore, the element name of the list item makes no difference whatsoever. As for how it changed to MyCompanyName ...


5

This is a known bug. You should contact Support to get the patch (you can use reference number 13144). The reason is that in the OnItemMoving function in the VirtualMediaFolderValidator class from SXA, this line: Database contentDatabase = ServiceLocator.ServiceProvider.GetService<IContext>().ContentDatabase; does not work when running in a publish ...


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 ...


4

Well you could extend the item:added event to then take the item name and update the title to have a formatted item name minus all the special characters. You would need to do a check to ensure the item that you are adding has a field called Title or else it would fail. This probably isn't the most efficient and elegant solution because you are basically ...


4

Thought I would give a more complete answer. If you would like to use Sitecore PowerShell Extensions to run custom scripts for events you can make use of the Events integration point. There is an example out of the box that you can check out. You'll need to enable the module to make use of it. There is also a configuration file distributed with many ...


4

Looks like your UAT is a Content Delivery Server and the List Manager is not disabled on it. Taken from the official Sitecore documentation (this one is for 8.2, but it hasn`t changed much from previous versions) Note You must completely disable List Manager and Path Analyzer on a content delivery server. So you will fix the error by removing the /...


4

I agree that this is many questions in one. As a start though this is from the Sitecore 6.3 PDF: Event Queues To ensure data and cache coherence and support communication between instances in an environment and between CM and CD environments, Sitecore CMS 6.3 maintains event queues as tables in Sitecore databases. Each Sitecore instance accesses one ...


4

If you only want to run your custom logic when the user saves an item from within the Sitecore client, you could use a saveUI pipeline processor instead. This would eliminate the need to check for these background job scenarios. Here is the basic structure of a saveUI processor: using Sitecore.Data.Items; using Sitecore.Pipelines.Save; namespace Example....


4

You can achieve this with Sitecore.Context.Job.Name During installation it will return: "Install" During normal item saving action Sitecore.Context.Jobproperty will be null


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