Working with variables
Last updated
Last updated
A variable is a value that can change, depending on conditions or information supplied by the user. Using the Patchworks connector builder, variables can be defined at different levels:
Level | Summary |
---|---|
Connector instance variables defined here can be used when you configure authentication methods. If you're defining multiple authentication methods which share common variables, define them once here and then choose to 'use' them in subsequent authentication methods. | |
Auth variables (whether added directly or picked up and 'used' from predefined connector instance variables) are displayed as fields for your users to complete whenever the associated authentication method is used to add a connector instance. | |
Endpoint variables are displayed as fields for your users to complete whenever they configure a process flow connection shape to use an associated endpoint. |
When a process flow runs, any associated API requests are injected with user-provided variable values wherever a corresponding {{variable}}
is found.
All variables added to connector builder API requests should be placed within double-curly brackets - for example: {{product_type}}
.
The sections below explain the use of variables in general terms - for specific guidance in a particular context, please use the links provided above.
When you choose to add or edit a variable, the add variable or manage variable page is displayed:
Options on this page are the same, irrespective of whether you're adding/managing connector variables, auth variables or endpoint variables. Use the table below as a guide for completing this page:
Field | Summary |
---|---|
Key | The name to be used by Patchworks internally, when referencing this variable. |
Display name | The field label that users will see if they are asked to enter a value for this variable. |
Alias | The name used by the actual system when referencing this variable. |
Default value | Enter a default value to be shown when this field is displayed to users. The maximum number of characters permitted is 1024. |
The remaining fields on this page determine if/how your users will interact with this variable when adding an instance of this connector:
Field | Summary |
---|---|
Is this required? | Toggle this option on to make this a mandatory field when a user either:
|
Is this configurable | Toggle this option on to make this an optional field when a user either:
|
Is this for advanced users only? | Advanced variables are those which 'regular' users would not typically need to see or change, but which advanced users might want to change in exceptional cases. With this option toggled on, the field for this variable is hidden in an advanced section when a user either:
Only select this option if this is a variable that 'regular' users would NOT typically need to see or change - but which advanced users might want to change in exceptional cases. For example, the |
Is this variable a secret? | Toggle this option on if values entered for this field are sensitive. Secret variables are stored in HashiCorp Vault. |
To edit a variable, simply click the variable name to open the standard variable settings page - for example:
From here, you can make your required changes and click the save button.
In some cases, a variable may be locked - these are variables which are required by Patchworks to perform a particular function (for example, default variables associated with authentication methods). In this case, you can't change settings or remove the variable, but you can change the display name.
In the case of a locked variable, you can change the name that users see for the associated field when they are asked to provide a value.
As such, we need to rename the To do this, click the field name and update the display name as appropriate - for example: