MikePohatu / TsGui

Custom GUIs in ConfigMgr
GNU General Public License v3.0
47 stars 5 forks source link

if cases in TSGui #17

Closed sophiegewillig closed 1 year ago

sophiegewillig commented 1 year ago

Hello all, I'm trying to achieve the following. The computertype can be "Laptop" or "Virtual Computer"

Depending on the choice for laptop it should then ask for a "dropdown location" - a "dropdown department" and a "dropdown software"

For virtual computer it should then ask only for a "dropdown software"

I have no idea how to alter the dropdown lists after choosing the computer type

MikePohatu commented 1 year ago

Hi there, you use the 'Groups and Toggles' feature to do this. The dropdown with the computer type is the toggle, and you disable/enable other items based on that toggle using the '' element. There is how-to videos on this feature on youtube: part 1 & part 2

If this lot doesn't help or you get stuck contact me via the 20road.com contact page

Here is an example config that should hopefully get you started:

<TsGui LiveData="TRUE">
    <Height>250</Height>
    <Width>450</Width>

    <HardwareEval />

    <Heading>
        <Title>TsGui</Title>
        <Text>Task Sequence GUI example config</Text>
    </Heading>

    <Page>
        <Row>
            <Column>
                <Formatting>
                    <LeftCellWidth>110</LeftCellWidth>
                    <RightCellWidth>160</RightCellWidth>
                </Formatting>

                <GuiOption Type="ComputerName" />

                <GuiOption Type="DropDownList">
                    <Variable>VAR_DeviceType</Variable>
                    <Label>Device type:</Label>
                    <SetValue>
                        <Query Type="IfElse">
                            <IF>
                                <Source>
                                    <Query Type="LinkTo">TsGui_IsVirtualMachine</Query>
                                </Source>
                                <Ruleset Type="AND">
                                    <Rule Type="Equals">TRUE</Rule>
                                </Ruleset>
                                <Result>
                                    <Value>VM</Value>
                                </Result>
                            </IF>
                            <ELSE>
                                <Value>Laptop</Value>
                            </ELSE>
                        </Query>
                    </SetValue>
                    <Option>
                        <Text>Laptop</Text>
                        <Value>Laptop</Value>
                    </Option>
                    <Option>
                        <Text>Desktop</Text>
                        <Value>Desktop</Value>
                    </Option>
                    <Option>
                        <Toggle Group="Group_NotVM" Invert="TRUE"/>
                        <Text>Virtual Machine</Text>
                        <Value>VM</Value>
                    </Option>
                </GuiOption>

                <GuiOption Type="DropDownList">
                    <Group>Group_NotVM</Group>
                    <Variable>VAR_Location</Variable>
                    <Label>Location:</Label>
                    <SetValue>
                        <Value>NZ</Value>
                    </SetValue>
                    <Option>
                        <Text>NZ</Text>
                        <Value>NZ</Value>
                    </Option>
                    <Option>
                        <Text>Aus</Text>
                        <Value>Aus</Value>
                    </Option>
                </GuiOption>

                <GuiOption Type="DropDownList">
                    <Group>Group_NotVM</Group>
                    <Variable>VAR_Department</Variable>
                    <Label>Department:</Label>
                    <SetValue>
                        <Value>LAB</Value>
                    </SetValue>
                    <Option>
                        <Text>LAB</Text>
                        <Value>LAB</Value>
                    </Option>
                    <Option>
                        <Text>HR</Text>
                        <Value>HR</Value>
                    </Option>
                    <Option>
                        <Text>IT</Text>
                        <Value>IT</Value>
                    </Option>
                </GuiOption>
            </Column>

            <Column>
                <Formatting>
                    <LeftCellWidth>110</LeftCellWidth>
                    <RightCellWidth>40</RightCellWidth>
                </Formatting>
                <GuiOption Type="CheckBox">
                    <Variable>MsOffice</Variable>
                    <Label>Microsoft Office</Label>
                    <HAlign>right</HAlign>
                </GuiOption>

                <GuiOption Type="CheckBox">
                    <Variable>MsVisio</Variable>
                    <Label>Microsoft Visio</Label>
                    <HAlign>right</HAlign>
                </GuiOption>

                <GuiOption Type="CheckBox">
                    <Variable>MsProject</Variable>
                    <Label>Microsoft Project</Label>
                    <HAlign>right</HAlign>
                </GuiOption>
            </Column>
        </Row>
    </Page>
</TsGui>