Need help using argument in reusable library

HI ,

i am trying to create a library which accepts 2 input argument and one output argument using invoke code activity using c#, but not getting pass argument while using that activity.
Please guide attaching the screenshot of the Library

Hello @vivek.srivastava you’re already on the right track, you just missed assigning values to your invoke code arguments

@vivek.srivastava

Invoke code arguments won’t be visible directly from the invoking the xaml or library.
You will have to create in and out arguments at the workflow level at MyLib.xaml
Once created assign those arguments to the Invoke code arguments respectively.

Hi @vivek.srivastava

To reuse your library , first publish the library project and then open your main process and install that library from Manage Packages, after that go to the Activities panel and search for your created workflow like AddNumbers and drag it into your Main.xaml, then create a variable like resultVar of type Int32, set the input arguments in_number_1 and in_number_2 with values such as 4 and 8, and assign the output argument out_result to resultVar,
when you run the workflow it will execute the library logic and store the result 12 in resultVar, so in this way the same logic can be reused across multiple processes without rewriting the code.

Happy Automation