|
Post by Brian C on Feb 26, 2019 17:20:11 GMT
I want to dynamically build a list in UI++. My thought was that I would call a powershell script that would set an environment variable to comma separated list of choices, then I would call "ChoiceList" with "OptionList" set to the environment variable, but its not working.
Right now I am testing outside of a TS so I am just using "regular" environment variables. If I change a variable with an externalcall does UI++ pick it up or does UI++ only scan the values at startup?
Example: %Sources% = "" when UI++ is called Part way through, if a checkbox was selected, then I will perform an externalcall <Action Type="ExternalCall" Title="External Command" Condition='"%Restore%" = "True"'>powershell.exe -ExecutionPolicy Bypass -File GetSources.ps1 -NoFile</Action>
Now the environment variable "Sources" to a comma separated list "SerialNum1,SerialNum2,SerialNum3"
Then I hit these directives: <Action Type="Input" Name="RestoreSource" Title="Restore Profile" Condition='"%Restore%" = "True" AND LEN("%Sources%") > 0'> <ChoiceInput Variable="RestoreSource" Sort="True" Question="Select A Profile To Restore"> <ChoiceList OptionList="%Sources%" AlternateValueList="%Sources%" /> </ChoiceInput> </Action>
Is there a best practice for setting the environment in PS so that UI++ sees it? Even if I get %Source% to populate, would this even work?
|
|
|
Post by Jason on Feb 26, 2019 22:37:04 GMT
UI++ never scans for variables. Task Sequence variables are directly accessed at the time they are referenced as are environment variables.
Thus, there's nothing special here and yes, this should work fine.
Also, there's no such thing as best practices.
|
|