Set Data Code and Get Data Code Methods.

SetDataCode Event runs before your activity executes and is useful to initialize/set your activity properties.

GetDataCode Event runs after your activity executes and is useful to output your activities values or set other workflow properties.

The Set Data Code and Get Data Code methods work exactly the same way as our Before and After execute event handlers do. The only difference is that when you use Before and After execute event handlers, it creates two separate classes for each, whereas when you use Set and Get Data Code methods, all the code is in just one class or at one place, which is easier to debug and read as well. In order to create Set and Get Data Code methods for the activity, right-click on the activity and select the Edit Get/Set Data Logic option, as shown in the “Image 1” below. It will generate a class with these methods see the “Image 2”.

Image 1
Image 2

 

Now you can write your code in these two methods as per your requirement.

Set Activity Example Code: SelectGroups Lookup