In InstallShield, how to change the value of my Property before it is used by SQL Text Replacement? - sql

What I want to do
In InstallShield I want to set the value of a Property before it is used by the SQL Text Replacement feature. I want the new Property value to come from an Edit control that I've added to a dialog.
What I've done so far
I have added SQL Scripts to my InstallShield project, which include placeholders for InstallShield's Text Replacement feature. I've used the Text Replacement tab to find and replace a placeholder in the SQL script with the value of a Property that I've added to the Property Manager. This works correctly, but only for the Property's default value.
Where I'm stuck
The problem is that I want the new value to come from an Edit control in my custom Dialog, but I can't find a way to do this. Text Replacement always uses the Property's default value.
What I've tried is the following InstallScript, which runs when the user clicks Next on my custom Dialog:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty ( hwndDlg, "EDIT_VALUE_FROM_USER", svValueFromUser);
Where EDIT_VALUE_FROM_USER is my Property. This runs without error, but the value doesn't come through to the final SQL script.
Why isn't the new value for EDIT_VALUE_FROM_USER being used by SQL Text Replacement? How can I diagnose why it's not working? Should I be doing this in a completely different way?

This turned out to be because I wasn't using the system property ISMSI_HANDLE.
So the correct code to write a Property from an Edit control in a custom dialog is:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty (ISMSI_HANDLE, "EDIT_VALUE_FROM_USER", svValueFromUser);

I'm guessing your property isn't listed in the SecureCustomPublicProperties property and is getting set back to it's default value when the installer transitions to the install execute sequence. A log file of the installation would give more data to work with.

Related

Get MS Project Title (Not Name)

I need to get the Title of a project rather than the name of it. This can be done using the ProjectSummaryInfoEx method for the application object but I'm not sure how to get this line to return the value I need. Without any commands, it simply opens up the Summary info dialog box, and any inputs I provide come back as an invalid argument.
Any help anyone can provide would be greatly appreciated.
I suggest using:
ActiveProject.BuiltinDocumentProperties("Title")
or a property of the Project object such as:
ActiveProject.Name
References: Application object, Project object, BuiltinDocumentProperties
In addition to Rachel's answers, you can also use this:
ActiveProject.Tasks.UniqueID(0).Name
UID zero will always be the project summary task, and the name property will be the title of the project.

Determine if i18n is enabled for a JCR Property

How to access the corresponding FieldDefinition, if I have only the jcr property name at hand.
Is there any desired functionality,like find a field definition by a jcr property name ? If not, how would I access configured field definitions in java code ?
Scenario : I need to determine, if a given jcr property name was configured to be an i18n-capable field in definition ?
The answer is you can never be sure if property was configured to be i18n-able (or have any other trait) at the time it was last edited as definition might have changes since.
However to achieve what you want (obtain the definition), what you need to do is:
get a parent node of the property in question,
get value of it's mgnl:template property. That's your templateId,
use the templateId to obtain template from the registry,
read value of dialog property of the template, that's your dialogId
use the dialogId to obtain dialog from the registry
scan tabs in the dialog to find property definition with name of the jcr property you have started with

Filter lookup inside a Dialog- CRM 2015 Online

How can we filter a lookup that is in a page of the dialog process.
E.g. I have a lookup to "incident" on Prompt and Response, I would like to filter it based on the value of a field in incident entity.
I tried:
Creating new views, also setting it as default.
addPreSearch and addCustomFilter on the field on the form(Not sure how to use these scripts inside the Dialog)
Any Ideas ?
Thanks you
Unfortunately this is not possible.
As an alternative you could consider adding a query to the dialog and a page with a prompt having an Option Set (picklist) response type.

how to get the modified value of property after the feature is installed?

I have used a dialog in OnFirstUIBefore() for users to input some information,
and stored them in property USERINF.
However, when I want to retrieve the value of USERINF inputted by user in feature_installed(),
what I get is a default value.
I have added the USERINF to SecureCustomProperties property, but still cannot get the modified value.
How can I fix the problem?
I've always written values like these to the registry, then used appsearch to get them out into the property again.
There is no built in way to persist values like these built into MSI.

WiX: How to create file name from a property value

I have a working WiX installer that correctly writes properties to certain INI files, which works fine, but I have a need to generate the name of an INI file on the fly, from the computer name, eg.
MACHINE(xxx).INI
where xxx is my computer name.
I have tried all sorts of combinations of properties and I just can't seem to get it working. Can anyone put me right ?
This is my latest attempt that doesn't work:
<Property Id="MACHINEINI" Value="MACHINE([%COMPUTERNAME]).ini" />
...
<IniFile Id="IniPermissions"
Directory="MYDIR"
Action="addLine"
Name="[MACHINEINI]"
Section="[ComputerName]"
Key="Permissions"
Value="TEST" />
I never see the value of MACHINEINI, as the filename that gets created is actually called
[MACHINEINI]
The value it writes in is correct, so I see the contents as follows:
[xxx] Permissions=TEST
(where xxx is my machine name)
I have tried using [ComputerName], [COMPUTERNAME], [%COMPUTERNAME]
When I build the installer, I get the following error:
C:\Source\blah\BLAH.wxs(50) : warning CNDL1077 : The 'MACHINEINI' Pro
perty contains '[COMPUTERNAME]' in its value which is an illegal
reference to an other property. If this value is a string literal,
not a property reference, pl ease ignore this warning. To set a
property with the value of another property, use a CustomAction with
Property and Value attributes.
The underlying Windows Installer table doesn't support this. Note that the FileName column is of type FileName. Only the Formatted type can take a [PROPERTY].
IniFile Table
You could need a custom action to write temporary records to the IniFile table to transform the file name. The advantage versus using a custom action to literally write the INI file is that rollback would be automatically handled for you.
It's not possible to tell you how to do this exactly since I don't know what language you'd want to use to write the custom action.
A simpler approach (from the installers perspective) would be to transform the [KEY] name inside a single INI instead of writing to different INI files.