|Q104413 : Deferred Execution Custom Action Cannot Retrieve a Property Value|
|InstallShield 2009 Premier, InstallShield 2009 Professional|
|Basic MSI, InstallScript MSI|
A deferred execution custom action that either accesses or sets a property is not working.
This is happening because custom actions have limited access to properties during the script execution phase of the installation. The script execution phase is when deferred custom actions are executed. The properties that are accessible to the deferred custom actions are ProductCode, UserSID, and CustomActionData. Deferred custom actions cannot set any properties.
It is necessary to set properties with custom actions that have an in-script execution option other than deferred execution.
CustomActionData - Getting properties
Your deferred custom action can get properties other than ProductCode and UserSID by using the CustomActionData property. If you set a property that has the same name as your deferred custom action before script execution starts, the value of that property will be available to your deferred custom action in the CustomActionData property. You can do this by creating a custom action that sets a property, such as this one:
You can create this using the custom action wizard. Select "Set a property" for type and make [INSTALLDIR] the target. Accept the default choices for the rest of the options. Insert this custom action into the Execute sequence after LaunchConditions. When you run the installation, this immediate execution custom action will set the property DeferredCustomActionName to the value of INSTALLDIR. When script execution begins, the value of DeferredCustomActionName will be available to the custom action named DeferredCustomActionName in the property CustomActionData.
Getting multiple properties
If your deferred custom action needs to access to more than one property, you will need to pack all of these properties into CustomActionData and then make your deferred custom action "unpack" them after it gets CustomActionData. Here is a version of the property setting custom action above, modified to handle multiple properties.
DeferredCustomActionName would use string functions to parse the value of CustomActionData property once it retrieved it. The following is a VBScript example of property "unpacking."
Dim PropArray PropArray = Split(Session.Property("CustomActionData"), ";") INSTALLDIR = PropArray(0) SetupType = PropArray(1) OTHERPROP = PropArray(2) 'Now do stuff with these variables...
In InstallShield 11.5 and earlier versions, deferred Installscript custom actions can directly read any properties and are actually not able to use the CustomActionData property.
In version 12 and newer it will be necessary to use the CustomActionData property as discussed in this article due to the changes to the Installscript architecture.
|Last Modified Date: 09-25-2012ID: Q104413|