Summary
Deferred Execution Custom Action Cannot Retrieve a Property ValueSymptoms
A deferred execution custom action that either accesses or sets a property is not working.
Cause
This is happening because custom actions have limited access to properties during the Execution sequence of the installation. There are two sequences used by a typical installation program: the User Interface sequence and the Execute sequence. The User Interface sequence displays dialog boxes and queries the target system, but does not make any system changes. The Execute sequence performs system changes, but does not display a user interface. The Execution sequence is when deferred custom actions are executed.
During installation, the Execute sequence runs in two stages, immediate mode and deferred mode. Immediate mode walks through the actions in the Execute sequence, generating an internal, hidden installation script; this script contains, for example, instructions for what files, registry data, shortcuts, and so forth, to install. Immediate mode does not touch the target system. Note that the User Interface sequence runs only in immediate mode.
The second stage of the Execute sequence, deferred mode, carries out the system changes described by this internal installation script. Strictly speaking, deferred mode is performed only for actions between the built-in actions InstallInitialize and InstallFinalize. During deferred execution, MSI property values are fixed and cannot be changed. Moreover, the values of only a handful of MSI properties can explicitly be read during deferred execution.
The properties that are accessible to the deferred custom actions are ProductCode, UserSID, and CustomActionData. Deferred custom actions cannot set any properties.
Resolution
Setting 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:
| Name | Type | Source | Target |
|---|---|---|---|
| MakeINSTALLDIRAvailable | 51 | DeferredCustomActionName | [INSTALLDIR] |
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.
| Name | Type | Source | Target |
|---|---|---|---|
| MakeManyPropsAvailable | 51 | DeferredCustomActionName | [INSTALLDIR];[SetupType];[OTHERPROP] |
Dim PropArray
PropArray = Split(Session.Property("CustomActionData"), ";")
INSTALLDIR = PropArray(0)
SetupType = PropArray(1)
OTHERPROP = PropArray(2)
'Now do stuff with these variables...
Additional Information
For more information on Windows Installer Properties, see the InstallShield Help Library topic:
Related KB Articles
There is a forum post: Getting the value of INSTALLDIR in deferred CAhttps://community.flexerasoftware.com/showthread.php?201283-Could-not-get-the-INSTALLDIR-value-using-the-Deferred-custom-action
This includes the steps to create this with an example project .
Related Articles
How to access MSI property with a deferred custom action 6Number of Views Setting or Getting the Value of a Property Via a VBScript Custom Action 4Number of Views Access SUPPORTDIR from a Deferred, Rollback, or Commit Custom Action 5Number of Views Difference Between Deferred Execution and Deferred Execution in System Context 9Number of Views Retrieve and Set Properties in a VBScript Custom Action 15Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago