Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

fredriktjarnberg
Jun 15, 2009
  5648
(1 votes)

Module Installation – Dealing with Regrets

If you’re an above average, EPiServer module installer developer you might have experienced writing a custom wizard for retrieving data. When doing so you take on a responsibility to handle cancellation, not only for your own script but for any script that is calling you (“install site with sql database” being one). This is easy to forget… I know from personal experience. The good news is that it is very easy to handle the event of user regrets (canceling your wizard) and here’s how":

In your PS script when calling the Show method on the wizard you need to get capture the return value.

$proceedWithInstall = $wizard.Show()

In order to terminate any active installer transactions you then need to look at the return value and if it’s false, you simply throw an exception to cause active transactions to rollback
 
if ($proceedWithInstall -eq $false)
{
throw(New-Object ApplicationException("User cancelled the installation"))
}

Not doing the above will make the surrounding script (Install site…) complete as if nothing happened.
Jun 15, 2009

Comments

Please login to comment.
Latest blogs
Level Up with Optimizely's Newly Relaunched Certifications!

We're thrilled to announce the relaunch of our Optimizely Certifications—designed to help partners, customers, and developers redefine what it mean...

Satata Satez | Jan 14, 2025

Introducing AI Assistance for DBLocalizationProvider

The LocalizationProvider for Optimizely has long been a powerful tool for enhancing the localization capabilities of Optimizely CMS. Designed to ma...

Luc Gosso (MVP) | Jan 14, 2025 | Syndicated blog

Order tabs with drag and drop - Blazor

I have started to play around a little with Blazor and the best way to learn is to reimplement some old stuff for CMS12. So I took a look at my old...

Per Nergård | Jan 14, 2025

Product Recommendations - Common Pitfalls

With the added freedom and flexibility that the release of the self-service widgets feature for Product Recommendations provides you as...

Dylan Walker | Jan 14, 2025

My blog is now running using Optimizely CMS!

It's official! You are currently reading this post on my shiny new Optimizely CMS website.  In the past weeks, I have been quite busy crunching eve...

David Drouin-Prince | Jan 12, 2025 | Syndicated blog

Developer meetup - Manchester, 23rd January

Yes, it's that time of year again where tradition dictates that people reflect on the year gone by and brace themselves for the year ahead, and wha...

Paul Gruffydd | Jan 9, 2025