Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Created May 4, 2023 17:54
Show Gist options
  • Save hishaamn/a2d764ddd9b10cfbf2d494804d74606f to your computer and use it in GitHub Desktop.
Save hishaamn/a2d764ddd9b10cfbf2d494804d74606f to your computer and use it in GitHub Desktop.
Eventhandler to trigger notification after installation
using Sitecore.Events;
using Sitecore.Install.Events;
using System;
public class PackageInstallationEvent
{
public void OnPackageInstallItemsEndHandler(object sender, EventArgs e)
{
if (e == null)
{
return;
}
var sitecoreEventArgs = e as SitecoreEventArgs;
if (sitecoreEventArgs == null || sitecoreEventArgs.Parameters == null || sitecoreEventArgs.Parameters.Length != 1)
{
return;
}
var parameter = sitecoreEventArgs.Parameters[0] as InstallationEventArgs;
if (parameter == null || parameter.ItemsToInstall == null)
{
return;
}
Context.ClientPage.ClientResponse.Eval("scForm.postMessage(\"" + ("cms:notification(eventName=package:end)") + "\")");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment