Append SmartForms Interaction Activity
Overviewβ
This activity allows you to dynamically append additional fields to existing SmartForms (your custom ones or Pia's), making it easier to gather extra data as needed.
Pia Automation Package Exampleβ
In this example:
- A PowerShell script defines a list of software options.
- The append_smartform_interaction task appends these options to the form named 'software_select'.
conditions:
- name: 'client_filter'
optMode: 'OptOut' # Set the opt-out mode for the client filter condition.
category: 'Hello World' # Category for the client filter condition.
steps:
# Step 1: Execute an inline PowerShell script.
- task: inline_powershell
inputs:
script: | # The script block starts here.
# Define an array of software options.
$software = @(
[PSCustomObject]@{text = "Adobe Acrobat"; value = "Adobe Acrobat"},
[PSCustomObject]@{text = "VPN Access"; value = "VPN Access"},
[PSCustomObject]@{text = "Google Chrome"; value = "Google Chrome"}
)
# Create a properties object containing the software options.
$formDefProps = @{
software = @($software)
}
# Convert the properties object to a JSON string and return it.
return @{
formDef = (ConvertTo-Json $formDefProps -Compress)
}
# Step 2: Append the custom fields to the specified SmartForm.
- task: append_smartform_interaction
inputs:
form_name: 'software_select' # Name of the SmartForm to which the fields will be appended.
form_def: =inline_powershell.formDef # The definition of the fields to append, obtained from the previous PowerShell script.
Check out the images below to see how the above package outputs and for a sample of what the appended form looks like!

