In this Article I will show you how to use a custom data type within the Script Component.
So you've created a "User Defined Type" from the Authoring section in a Workflow Integration Component
UserDefinedType
TextProperty (Text)
IntegerProperty (Number (integer))
Make sure to note the Namespace:
Generated.POC_Scripting_INT |
---|
Generators
UserDefinedType
UserDefinedType
Now create a Workflow.
Use an Add Data Element and create a element of your new Data Type.
DataType | UserDefinedType |
---|---|
Variable Name | UserDefinedType |
Add some values
Integer Property | 1 |
---|---|
Text Property | Alex Hedley |
Search for a Script Component. The Library may not have been added so should show in the Unloaded Libraries section.
You could also add "LogicBase.Components.Scripting.dll" in the Libraries tab of the Project section.
Join this to your previous component.
Double click on this to start up the Wizard.
Add your variable name and choose it's Type:
Click on Edit Parameter Mappings.
Select the Parameter then choose the Data Source:
Click OK then Next.
Choose your "Result variable type" and "Result variable name":
Now to the Source Code.
You can choose which one you prefer. (C#, VB.NET, JScript)
Here is where you need to add your previous namespace.
Using namespaces (one per line): |
---|
System Generated.Generated.POC_Scripting_INT |
Now you can use your Type in the code:
return UserDefinedType[0].TextProperty; |
---|
There is a handy test you can perform at the end to check it is working.
Obviously you can do more complex things than just getting a single Property but this explains the initial set up.