Search code examples
workflow-foundation-4workflow-foundation

How to access return value from a custom code activity?


I build a simple custom native activity that return a string value.

public sealed class MyActivity : NativeActivity<string>
{
     public InArgument<string> Id { get; set; }

     protected override void Execute(NativeActivityContext context)
     {
         var returnString = QuerySomthing();

         context.SetValue<string>(base.Result, returnString);
     }
}

How can I get this value in the workflow's variables?


Solution

  • You can access the 'Result' property of your activity. All you need to do is create a variable on the workflow (of type String) and bind this to the 'Result' property. Then you can access the variable later on in the workflow to analyse its value. HTH

    enter image description here