cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jason_Sanborn
Level 3

Validate Serial Number for Basic MSI?

I need to add some sort of custom action to the Customer Information Dialog's Next Button to evaluate what the user entered in the Serial Number field. If the validation fails, it needs to display an error dialog and return to the Customer Information Dialog. If it succeeds, it moves on to the Ready to Install Dialog.

Is there a way to insert a custom action in between the dialogs? A way to change properties via a custom action at this point so that the appropriate dialog is displayed?
Labels (1)
0 Kudos
(1) Reply
charlieantao
Level 6

Here's the way to do it, if it's a single branch, ie. if the custom action succeeds, show dialog A, if it fails, show dialog B. It can easily be extended for multiple paths.

Create the required action, and do not put it in any of the sequences. The custom action should set some property, say SerialNumberValid to 1 or 0, based on whether the serial number is valid or not. See MsiSetProperty documentation for setting properties.

Go to the dialog view to the dialog where you are validating the serial number and go to the Behavior tab (it opens when you click the + sign of the dialog)

Choose the Next button, and delete the entries that are there

Add a new behavior to run your CA
Event -> DoAction
Argument -> (Name of your CA)
Condition - (Leave it blank)

Add one behavior for the success dialog
Event -> NewDialog
Argument -> (Name of your success dialog)
Condition - [SerialNumberValid] = "1"

Add one behavior for the failure dialog
Event -> NewDialog
Argument -> (Name of your failure dialog)
Condition - [SerialNumberValid] <> "1"

Make sure that the CA entry is the first one. The actions are processed top-down.

Also verify that your Back and Next buttons on the preceding and next dialogs point to the right dialogs, otherwise you'll end end with buttons that don't do anything
0 Kudos