Home > Forum > Plugins > SDK configuration with a dynamic grid

SDK configuration with a dynamic grid
0

MVP

I have the challenge to read form fields of a pdf document and store them in the workflow instance.
The idea is, to implement an sdk custom action, where I am able to configure a mapping between the pdf form fields and fields of the workflow instance.

The ideal solution is having two columns in a dynamic grid (similar as in the image attached), where i am able to add as many rows as i need. One to define a name of the form field (text) and another to pick from my workflow fields.
I found some classes like ConfigEditableGrid, ConfigEditableGridColumn in the SDK, but I'm missing samples how to use them.

Does anybody have experience with this type of configuration?

MVP

I had some problems with this one too. :)
Once you know how to use them it's fairly easy

Create a class where each property is one column.

public class Mapping
{
[ConfigEditableGridColumn(DisplayName = "Target column", Description = "DB name of target item list column.", IsRequired = true)]
public string SourceColName { get; set; }

[ConfigEditableGridColumn(DisplayName = "Target value", Description = "The value which will be written to the column.")]
public string Value { get; set; }

[ConfigEditableGridColumn(DisplayName = "Target value type", Description = "The target type of the value.<br/><ul><li>Boolean = 0</li><li>Choose = 10</li><li>DateTime = 20</li><li>Decimal = 30</li><li>Text = 40</li><li>Picker = 50</li></ul>", IsRequired = true, DescriptionAsHTML = true)]
public string Type { get; set; }


}

Afterwards add a property to the PluginConfiguration with type List<CreatedClass>:
[ConfigEditableGrid(DisplayName = "New values")]
public List<Mapping> Mapping { get; set; }

In you logic you can easily iterate through the "rows" of your grid
foreach (var mapping in Configuration.SourceConfiguration.Mapping)
{}

Best regards,
Daniel