nchounlapane
Posts: 28
Joined: Tue Mar 31, 2020 10:01 pm

Issues with AI_SetMSIProperty with inline powershell custom action without sequence

Tue Dec 08, 2020 11:56 pm

Within the dialogs, I currently have an event under published events for the 'Next' button to execute a inline powershell non-sequenced custom action. This custom action simply checks user input and will set a certain install parameter value to either true or false (via

Code: Select all

AI_SetMSIProperty MyProperty value
). Within the same published event of the 'Next' button, the event after that shows a child dialog based on the condition of the previous set. So if the install parameter was false, the child dialog will show (as an error message).

The issue I'm facing is that during runtime, the custom action does execute when 'Next' is pressed but doesn't seem to set the install parameter (gets set later based on the logs?). I require the install parameter be set immediately once the custom action is executed, in order for the next published event to check for that install parameter.

The ideal sequence goes like this:

1. User inputs information within dialog
2. User clicks on the 'Next' button
3. The first published event validates the data and sets an install parameter
4. The second published event checks the set install parameter and displays a specific child dialog based on it's value

What I've also noticed is that within the MSI logs, when you call AI_SetMSIProperty, it usually outputs

Code: Select all

InstallProperty changed value to "value"
but I did not see such thing. I have tested the custom action within Advanced Installer (Test Script button) and it works as intended.

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Issues with AI_SetMSIProperty with inline powershell custom action without sequence

Fri Dec 11, 2020 3:33 pm

Hello,

I am not quite sure I fully understand what the problem is here.

Is the problem the fact that the dialog is not displayed despite the condition being met (e.g. your property is set to false)?

If that is the case, could you please let me know what actually happens? Is the dialog that follows in sequence displayed instead?

If that is the case, this might be happening because of the events order.

PowerShellCA.png
PowerShellCA.png (64.73KiB)Viewed 1669 times
ExecutionOrder.png
ExecutionOrder.png (193.52KiB)Viewed 1669 times

The majority of events are executed from top to bottom (e.g. if there was one more custom action sequenced, say a VBS custom action, the PowerShell script would have been executed first and then the VBS one).

However, in case of the dialog events, the order is the other way around, from bottom to top (note the arrow pointing towards top).

Therefore, if you would have the events ordered as it follows:

Display a specific child dialog --> Spawn DIalog
Display a specific dialog --> FolderDlg


even if the condition for the "Display a specific child dialog" is met, the event will not be executed because the "Display a specific dialog" event is executed and the "FolderDlg" is called next in sequence.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”