Search code examples
workflow-foundation-4

Workflow: Trying to pass an object variable to a class method


I am having a tough time trying to pass a parameter into my method when I go to invoke it.

I new up a variable called setupNewCase, then I populate it with data. Once I do that, I then try to invoke the method. It normally works when I don't have a value to pass into it, but it doesn't work here in this case as I am trying to pass something into it.

My screen shot


Solution

  • To pass parameters to the invoked method you use the Parameters property on the InvokeMethod activity. Its available on the activity's properties grid and not directly on the designer.

    You would use TargetObject when invoking a method on an instance object but since your CommonMethods class is static you won't ever instantiate it and therefore TargetObject should be empty.