Skip to main content
Version: 2022.1

Configuration attributes

Basic information about SDK plugin configuration can be found in the following article: plugins configuration. Below you find a detailed description for defining plugin configuration fields in the code and how they work in Designer Studio.

PluginConfiguration class

Most SDK plugin types require their base class to be a generic of the configuration class. The only exception is Form Field Extension JS which contains the interface part only. If we use SDK templates for Visual Studio, a separate file with the configuration class is created automatically, and our plugin will a generic of that class. The configuration class, inheriting from PluginConfiguration, allows us to control what the configuration form will look like in Designer Studio. The contents of this class are usually properties which we will reference from the plugin as well as configuration attributes that determine the look of controls in Designer Studio.

Usage in code

Here are examples of action class and configuration class declarations

public class ExampleAction : CustomAction<ExampleConfiguration>
{

}

public class ExampleConfiguration : PluginConfiguration
{

}

In the plugin code we can load in the required values defined in the configuration class. Usually, the user will pass these values using variables (reference tags), but in the code we have access to their evaluated values depending on the environment. If we want to preview what exact values the configuration will have in the moment the code is executed, we can turn on automatic logging. It is available in Designer Studio in the Plugin Packages section. Each plugin has a separate logs configuration in the Logs tab. The logs automatically save the configuration class and its values in JSON format.

Configuration attributes

To streamline the configuration of plugins in WEBCON BPS, certain attributes are available that can be configured as properties of the configuration class. By using them we can influence the interface look in Designer Studio during plugin configuration

Each attribute has a set of properties corresponding to its type, and a part will be the same for all attributes. The shared ones include:

  • DisplayName - determines the name of the configuration field in Designer Studio, it’s shown as the label to the left of the control
  • Description - can be used to provide a more detailed description that will be available under the Help (i) the right of the control
  • IsRequired - marks the field as required, this field will have a red asterisk next to it (*) and the user will be informed of it being required when attempting to save
  • DescriptionAsHTML - Boolean marker, if set to TRUE, it will interpret all html tags in the description
  • DefaultValue - available for most attributes, can be used to enter a default value, the type will depend on the type of attribute

These attributes determine how data is passed during plugin configuration, but the data type in the code is defined by the property type for which the configuration attribute is used. Therefore, one should remember that if the value passed through the configuration does not match the property type, we will receive a conversion error when executing the plugin. Additionally, if we want to pass a value from a form field, and there is a possibility that this form field will be empty – we need to prepare for this by using a nullable property type.

ConfigEditableText

The most commonly used attribute that allows the person configuring the plugin to enter any string of text. They are able to pass variables (reference tags) whose values will be substituted based on the context in which the plugin is executed.

Additional properties:

  • IsPasswordField - text entered during configuration will be masked, and the value will be encoded. The control will only show asterisks. When executing the plugin the value will be decoded.
  • Multiline - increases the number of rows of the configuration field, setting it to TRUE will give us 3 rows of text by default
  • Lines - determines the number of rows for Multiline
  • ReadOnly - field will be in read-only mode, it will show the value returned by the property or the default value
  • MaxLength - determines the maximum number of characters that can be entered here
  • NullText - grayed out text displayed for an empty field value
  • TagEvaluationMode - enum determining the mode in which variables will be substituted. The available options are:
    • Default - standard mode of substituting variables
    • None - variables will not be substituted
    • SQL - replaces variables and escapes them in SQL mode, used practically for all SQL queries
    • JavaScript - converts variables to format #{123}#, which allows for requests to be passed e.g. in JSON format

ConfigEditableText

ConfigEditableBool

In Designer Studio this field appears as a checkbox. Since it cannot be used to pass dynamic values via variables, it is most commonly used for static toggles like expanded logging, different mode for the plugin etc.

ConfigEditableBool

ConfigEditableConnectionID

Attribute used to designate a connection defined in Designer Studio. It contains an expandable tree with all available connections. In the code we will get the ID of the chosen connection. Used in conjunction with the tool class ConnectionsHelper we can load all necessary data for connections without reconfiguring them from scratch inside the plugin. Additionally, ConnectionsHelper takes into consideration dev/test/prod settings so that we always get the correct data.

Additional property:

  • ConnectionsType - filter allowing us to narrow down the available connection types to specified ones. We can join types with the standard operator e.g.: DataConnectionType.WebServiceREST | DataConnectionType.WebServiceSOAP

ConfigEditableConnectionID

ConfigEditableDataSourceID

Analogous to the attribute for connections, but operates on data sources instead. It contains an expandable tree with all available data sources, and the ID of the chosen source in the code. For further operations on the ID of a source we can use DataSourcesHelper and ConnectionsHelper classes.

Additional property:

  • SourcesType - filter allowing us to narrow down the available data source types to specified ones

ConfigEditableDataSourceID

ConfigEditableDateTime

Control for selecting the date and time, can be used to pass a static date value. Rarely used just like the ConfigEditableBool attribute. It is more common to dynamically pass the date with a ConfigEditableText attribute and a variable that references a “Date and time” form field.

Additional properties:

  • ShowDate
  • ShowTime - Boolean value, both set to True by default. Used to toggle parts of the control.

ConfigEditableDateTime

ConfigEditableDouble

ConfigEditableInteger

Two attributes that work almost identically, but one can only be used to set integers. The control limits the user to numerical values. If you need to pass a value that depends on the context, replace with a text attribute and a variable referencing a number in the correct format.

Additional properties:

  • MinValue
  • MaxValue - fields which determine the upper and lower limits of the value that the user can enter

ConfigEditableDouble ConfigEditableInteger

ConfigEditableDropDownList

Dropdown control from which one value can be selected.

  • DataSourcePropertyName - a required parameter where you pass the property containing a table of available values

Due to the very specific way of how this attribute is implemented, as shown below, it is often replaced with the analogous ConfigEditableEnum control.

public DropDownListItem[] DdlItems => new DropDownListItem[] 
{
new DropDownListItem("1", "Value1"),
new DropDownListItem("2", "Value2"),
new DropDownListItem("3", "Value3")
};

[ConfigEditableDropDownList(DisplayName = "Sample dropdown list", DataSourcePropertyName = "DdlItems")]
public string DropList { get; set; }

ConfigEditableDropDownList

ConfigEditableEnum

A control which looks and behaves just like ConfigEditableDropDownList, but with the caveat that this attribute must be applied to a property returning an enum. The list will show the enum values during configuration.

ConfigEditableEnum

ConfigEditableFormFieldID

Attribute whose control displays a choice tree (identical to a “Choice tree” form field) from which you select a value. Similarly to connections and data sources, in the code we get an int with the ID of the selected value.

Additional property:

  • FormFieldTypes - filter limiting the tree to only selected types of attributes

ConfigEditableFormFieldID

ConfigEditableTranslationsList

Attribute which is used by the user to translate phrases into chosen languages. It is most commonly used to translate notifications or control labels. The property type must be a class containing ConfigEditableTranslation attributes. We will get correctly translated phrases depending on the user profile language in the code runtime, or the default phrase if there is no language match. Additional properties:

  • AdditionalCultures - parameter defining additional cultures can be selected for translations. It accepts a string with culture acronyms separated by semicolons e.g.: en-US;pl-PL

  • ConfigEditableTranslation Attribute related to the previous one, used to enter a singular phrase to translate. It must be used in a class using the attribute: ConfigEditableTranslationsList. DisplayName determines what the user should translate. DefaultTranslation can be used to set a default translation that can be edited in Designer Studio.

ConfigEditableTranslationsList

ConfigEditableItemList

Attribute used to map Item list columns. The control in Designer Studio is made up of two parts: a dropdown from which an Item list form field is chosen, and a grid with available columns. Must be applied to a property whose class implements the IConfigEditableItemList interface, which will provide a property with the ID of the chosen list.

  • ConfigEditableItemListColumnID Attribute related to ConfigEditableItemList, and must be used in its class. In Designer Studio it will appear as a row of a grid, the left column will contain the DisplayName value, and the right will contain a choice tree with available list columns.

ConfigEditableItemList

ConfigEditableGrid

Attribute used to create a custom grid for some of the more involved configurations e.g.: mappers. It should be applied to a List type property from the class that will also contain specific column definitions.

Additional properties:

  • TagEvaluationMode - – works identically to ConfigEditableText, it affects the mechanism of substituting variables for all text columns on the grid.
[ConfigEditableGrid(DisplayName = "Sample grid", TagEvaluationMode = EvaluationMode.SQL)]
public List<GridColumns> SampleGrid { get; set; }

public class GridColumns
{
[ConfigEditableGridColumn(DisplayName = "Sample column)]
public string SampleColumn { get; set; }
}
  • ConfigEditableGridColumn – most basic grid column used for entering any text or variables
  • ConfigEditableGridColumBoolean
  • ConfigEditableGridColumnDropDownList
  • ConfigEditableGridColumnEnum
  • ConfigEditableGridColumnFormFieldID – columns that are direct analogues to their non-grid variants

ConfigEditableGrid

ConfigGroupBox

Grouping attribute, allows us to bundle together some of the configuration fields into an expandable list. Placed in a class that should contain a property with any field attributes.

Additional property:

  • Order - int value that determines the order in which groups are displayed

ConfigGroupBox

ConfigStudioTranslation

Attribute for setting the translations of names and descriptions of other attributes via configuration control in Designer Studio. Should be placed above another configuration attribute, and should be used again for each translation.

Additional property:

  • TranslationCulture - enum for selecting the language culture to which the translation refers, the three available languages for Designer Studio can be selected: plPL, enUS, deDE
[ConfigStudioTranslation("Basic text attribute", "Description of the text attribute. The default descriptions are in Polish.", TranslationCulture.enUS)]
[ConfigStudioTranslation("Grundlegendes Textattribut", "Beschreibung des Textattributs. Die Standardbeschreibungen sind in Polnisch.", TranslationCulture.deDE)]
[ConfigEditableText(DisplayName = "Podstawowy atrybut tekstowy", Description = "Opis atrybutu tekstowego. Domyślne opisy są po polsku.")]
public string BasicText { get; set; }