Get Client Config Activity
Overviewβ
The Get Client Config (get_config_form_data) activity in Pia package editor retrieves the data of a configuration form that is enabled for a Package or the Global Config form for the specific Client the Activity is run under. With the Get Client Config activity, you can directly retrive the stored values for your client during package execution.
The Get Client Config activity can be located by searching for "Get client config" in the list of activities in the package editor:
Below is the code snippet that shows how you can use the Get Client Config Form activity to retrieve required data directly from the Global Configuration Form:
# Orchestrator package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Testing'
- name: 'chat'
option_button: 'Test Package'
option_text: 'This is a test package'
option_category: 'Test Category'
steps:
- task: get_config_form_data
inputs:
global: "True"
- task: inline_powershell
inputs:
globaladminUPN: =get_config_form_data.formDef.adminUpn
script: |
Write-Host "Admin UPN is $globaladminUPN"
Activity Behaviourβ
The primary purpose of the Get Client Config activity is to retrieve the stored values either from the Global Configuration Form or the form enabled for the package so that they can be used in your package execution.
One requirement to this behaviour is that you will need to define the "variables_form" property in the client filter condition, if you wish to return values for forms other than the global configuration form.
The Get Client Config Activity can be used in all package executions (i.e. packages that are initiated via Schedule or Ticketing System Event or the Chatbot).
Input Propertiesβ
Use properties to modify the behaviour of the activity.
Property Name: client_id
Default Value: $Ctx_CW_Client_Id
Property Required: Yes
Property Description: This is the interbal client id and will default to the client id for the ticket associated with this package.
Property Name: global
Property Options: 'True' or 'False'
Default Value: False
Property Required: Yes
Property Description: This is to define whether the activity is retrieving values from a global form or a custom form. It will retrieve the formDef from the Client "Global Configuration" that is setup on the Client screen.
Property Name: package_id
Property Required: If global = false, this property is required. If global = true, this property is not required.
Property Description: This will be the GUID of the Package that has the config form on it in the 'client_filter' conditions.
Output Propertiesβ
There is a single property which the Get Client Config activity makes available:
Property Name: form_def
Property Required: If global = false, this property is required. If global = true, this property is not required.
Property Description: This will return an object in JSON structure containing the stored values in the form.
Examplesβ
Below is an example where the entire Global Configuration Form is retrived and the individual values are extracted as required:
# Orchestrator package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Testing'
- name: 'chat'
option_button: 'Test Package'
option_text: 'This is a test package'
option_category: 'Test Category'
steps:
- task: get_config_form_data
inputs:
global: "True"
- task: inline_powershell
inputs:
globalForm: =get_config_form_data.formDef
script: |
$mode = $globalForm.modeOption
$allStaffGroup = $globalForm.cloud_all_staff_group
Write-Host "ModeOption: $mode"
Write-Host "AllStaffGroup: $allStaffGroup"