Invoking arguments into a coded workflow

I have a coded workflow as seen below:

And i would like to be able to pass arguments into it using an invoke workflow.
How do I do this?


As when trying I just get an error, thanks

Hi @aquinn

In the Main xaml file create a variable with the data. In the invoke xaml file you have the argument. Click on the import arguments and pass the variable to that argument.

If you want to the pass the argument to the code then Click on Edit arguments and pass the variable to the argument.

Hope it helps!!

I have done this but it just returns an error

HI, I am using a coded workflow so if i use invoke code theres no point in having it? if that makes sense

You are giving the value there like “Alex”. First take a assign activity and create a variable Name then in the value give the “Alex”. Then pass that Name variable to that argument @aquinn

Hi, I have done this and I am getting an error in the coded workflow

When you are passing the variable in the code. Hit on the Ctrl+Space button then it will shows the arguments then hit on the argument what you want @aquinn

Hi, it does not show the variable of “Name” in the dropdown

@loginerror @ppr Is this possible?

Save the Workflow then try to do it again. Close and reopen the workflow then try do it.

If you can’t get the solution schedule a google meet. We will connect.

Can I send you the .xaml here if that’s okay?

Coded (3.0 KB)

Please see code - thank you very much!


First type the Name then hit on Ctrl+Space then you get the Name variable like the below image then click on that variable. It works for me. Please check once by doing like this.

Hope it helps!!

Have you declared it in the workflow or is this coming from the argument in main.xaml? Can you please attach the workflow file if that is okay?

As I need to pass the value from the main.xaml into the workflow.cs file via argument

You will need to add the arguments to the Execute method in your coded workflow, otherwise they cannot be passed through to the coded workflow. For now, in the Invoke Workflow activity for Windows projects you will have to manually add the arguments to the list, they are not found automatically.

See for a set of examples regarding invoking between workflows and coded workflows.

This example in particular defines arguments in a coded workflow and this workflow invokes it.

Limitation: If you only have one output argument just write e.g. public string Execute() and you’ll have the Output argument (the name cannot be changed).


Thank you for this, so just to clarify I can have an argument in my main .xaml and I can pass it into the .cs coded workflow file using this?

1 Like

Yes, this is how you’d pass any variable or argument’s value in a XAML workflow to a coded workflow.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.