Skip to main content

Customize Pia's SmartForms using Extension Automations!

This guide will walk you through the process of customizing existing SmartForms (including Pia's!) using the power of Extension Automations. Whether you're looking to extend your own SmartForms or modify existing Pia's SmartForms, this guide will provide you with the necessary steps to make your forms more personalized to meet you clients' specific needs and processes!
Before You start

To get the most out of this guide, you should be familiar with custom automations and Extension Automations. If not, our reference guide here can help you get up to speed.

In this example, leveraging Extension Automations, we are going to customize the Staff Onboarding Pia SmartForm by allowing your clients to select from a list of programs to be installed along with their newly created new email address. The form is then presented to your engineers in the Pia chatbot within your PSA.

Step 1: Create a Custom Form​

  1. πŸ“¦ Open your Sandbox

  2. πŸ”Ž Navigate to the Form Editor:

    • From the left sidebar, select Automation > Form Editor.
  3. πŸ“ Create a New Form:

    • Click on New Form and enter the form properties.

      For the purposes of this example, we've used the following:alt text
  4. βž• Add Form Elements:

    • From the Toolbox, drag and drop the following elements into the form:
      • Form Section
      • Checkboxes
      • Text Input alt text
  5. βš™οΈ Assign the Reference Names by hovering your house over each element and clicking the pencil icon. alt text

    • For the Checkboxes, assign the Reference Name as software alt text

    • For the Text Input, assign the Reference Name as hideMe alt text

  6. πŸ’Ύ Close the Edit window, and then Save the form to see the changes.

info

Need more info? For detailed instructions on how to build forms, check out the Form Editor documentation.

Step 2: Create your first child extension​

  1. πŸ”Ž Navigate to the Package Editor:
    • From the left sidebar, select Automation > Package Editor.
    • Click on New Package to start creating a new package.
  2. πŸ› οΈ Define Package Details:
    • Name your package appropriately, in this example, "Child Extension 1 - Append Form".
  3. βš™οΈ Set Up Package Conditions:
    • Define conditions for when the package should be executed.
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'
  1. 🎯 Add Tasks to the Package:
  • Add a PowerShell script to dynamically create form definitions.
steps:
- task: inline_powershell
inputs:
script: |
$software = @(
[PSCustomObject]@{text = "Adobe Acrobat"; value = "Adobe Acrobat"},
[PSCustomObject]@{text = "VPN Access"; value = "VPN Access"},
[PSCustomObject]@{text = "Google Chrome"; value = "Google Chrome"}
)
$formDefProps = @{
software = @($software)
}
return @{
formDef = (ConvertTo-Json $formDefProps -Compress)
}
  • Use the append_smartform_interaction activity to append additional fields to the specified SmartForm.
- task: append_smartform_interaction
inputs:
form_name: 'software_select'
form_def: =inline_powershell.formDef
  • Your final code should look like this:
# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'

- name: 'extension_automation'

# Define list of programs
steps:
- task: inline_powershell
inputs:
script: |
$software = @(
[PSCustomObject]@{ text = "Adobe Acrobat"; value = "Adobe Acrobat"}
[PSCustomObject]@{ text = "VPN Access"; value = "VPN Access"}
[PSCustomObject]@{ text = "Google Chrome"; value = "Google Chrome"}
)

$formDefProps = @{
software = @($software)
}

return @{ formDef = (ConvertTo-Json $formDefProps -Compress)}

# Append my extra fields to the smartform
- task: append_smartform_interaction
inputs:
form_name: 'software_select'
form_def: =inline_powershell.formDef

Step 3: Create your second child extension​

  1. πŸ”Ž Navigate to the Package Editor:

    • From the left sidebar, select Automation > Package Editor.
    • Click on New Package to start creating a new package.
  2. πŸ› οΈ Define Package Details:

    • Name your package appropriately, for example, Child Extension 2 - Read Form.
  3. βš™οΈ Set Up Package Conditions:

    • Define conditions for when the package should be executed.
      conditions:
      - name: 'client_filter'
      optMode: 'OptOut'
      category: 'Hello World'
      - name: 'extension_automation'
  4. 🎯 Add Tasks to the Package:

    • Add tasks to retrieve and display the form data.

      steps:
      - task: get_form_data
      alias: sf_app_1
      inputs:
      form_name: 'software_select' # Retrieve form data from the 'software_select' form

      - task: inline_powershell
      alias: 'hide_skips'
      inputs:
      sf_variable_1: =sf_app_1.form_data.software # Get the software data from the form
      script: |
      $softwareList = @()
      foreach($software in $sf_variable_1 -split ",") {
      $softwareList += [PSCustomObject]@{ text = "$software"; value = "$software"; selected = $true}
      }

      $formDefProps = @{
      software = @($softwareList)
      hideMe = "submittedForm"
      }
      return @{ formDef = (ConvertTo-Json $formDefProps -compress) } # Return the form definition JSON

      - task: chat_interaction
      inputs:
      text: |
      The client has selected the following additional programmes:
      form_name: 'software_select'
      form_def: =hide_skips.formDef # Use the form definition created in the PowerShell script
      form_display_mode: 'Embed' # Embed the form in the chat interaction
    • Your final code should look like this:

    # Pia Automation Package
    conditions:
    - name: 'client_filter'
    optMode: 'OptOut'
    category: 'Hello World'
    - name: 'extension_automation'

    # Define list of programs
    steps:
    - task: get_form_data
    alias: sf_app_1
    inputs:
    form_name: 'software_select' # Retrieve form data from the 'software_select' form

    # Process form data using PowerShell script
    - task: inline_powershell
    alias: 'hide_skips'
    inputs:
    sf_variable_1: =sf_app_1.form_data.software # Get the software data from the form
    script: |
    $softwareList = @()
    foreach($software in $sf_variable_1 -split ",") {
    $softwareList += [PSCustomObject]@{ text = "$software"; value = "$software"; selected = $true}
    }

    $formDefProps = @{
    software = @($softwareList)
    hideMe = "submittedForm"
    }
    return @{ formDef = (ConvertTo-Json $formDefProps -compress) } # Return the form definition JSON

    # Display form data in chat interaction
    - task: chat_interaction
    inputs:
    text: |
    The client has selected the following additional programmes:
    form_name: 'software_select'
    form_def: =hide_skips.formDef # Use the form definition created in the PowerShell script
    form_display_mode: 'Embed' # Embed the form in the chat interaction

Step 4: Assign Extensions to the SmartForms Package​

  1. πŸ”Ž Navigate to SmartForms:

    • From the left sidebar, select SmartForms > Forms. alt text
  2. 🧩 Configure Extensions:

    • Find the relevant form (e.g., Staff Onboarding) and click Configure under the Configure Extensions section. alt text
  3. πŸ”— Assign Extensions:

    • Select the relevant client and assign the extensions:
      • Append to SmartForm: Assign Child Extension 1 - Append Form.
      • Process My Appended SmartForm: Assign Child Extension 2 - Read Form. alt text
  4. πŸ’Ύ Save Configurations:

    • Click Save to apply the configurations.

Step 5: Test the Configuration​

  1. ⬆️ Promote Packages and Form to Live:
    • Ensure that all packages and forms are promoted to the live environment.
  2. πŸ“„ Log into SmartForms as the Target Client:
    • Access the SmartForms portal as the target client to test the configuration.
  3. βœ… Verify the Staff Onboarding SmartForm:
    • The Staff Onboarding SmartForm should now include the newly added section for selecting software.

      The form should look like the screenshot below:
oops
  1. πŸ“ Submit the Form:

    • Fill out and submit the form as the target client.
  2. βœ… Check the ChatBot Perspective for Engineers:

    • Once the form is submitted, the corresponding information should appear in the Pia chatbot for your engineers. The chat interaction should look like the screenshot below: alt text

Additional References:​

  • To learn more about the SmartForms workflow, click here
  • To learn more about the ticket flow of your SmartForm, click here