Created
May 4, 2023 17:54
-
-
Save hishaamn/a2d764ddd9b10cfbf2d494804d74606f to your computer and use it in GitHub Desktop.
Eventhandler to trigger notification after installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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