Siddharth Joshi
Siddharth Joshi

Reputation: 1

How to use variables as part of arguments to Windows Workflow Activity (Using Designer)

I am writing an automation solution using Windows Workflow foundation. Where code activities will be written for necessary elements of the requirement. Users can then use these code activities (along with in-built ones) to create their own workflow (using visual studio activity designer) and execute it.

Users need to create necessary variables for their workflow and map according to their requirement. I am finding problem in using a variable as input to another activity.

For example - There is a sequence which has two activities. I have defined a string variable for sequence activity, and want to pass that variable plus some pre-defined strings as an input argument for one of the activity. I am not sure how to use proper C# expression to do it.

I tied below C# expression as an input argument to the activity String.Format("This is the text {0}", s);

where "This is text" is predefined part and 's' is the variable defined for sequence. However it does not seem to work. Any pointers on how can i achieve it ?

Upvotes: 0

Views: 568

Answers (1)

user8170659
user8170659

Reputation:

If I understand the question correctly, you want to set the variable 's' from an argument? If so, you will need to use an 'Assign' activity to do this before the next activity in line. So let's say you have a sequence like this:

Sequence (ARGS: arg1 IN, VARS: s) arg1 = "Friend"

  • Assign: s = arg1
  • WriteLine: String.Format("Hello {0}!", s)

Would print: Hello Friend!

Upvotes: 0

Related Questions