C#
The C# action runs C# code in a botflow. You must be familiar with Microsoft's C# programming language to supply the C# code necessary to add a C# action to a botflow.
The C# action is useful for creating an action not supplied with Nintex RPA LE.
Explore the items listed below to learn more about the basics of adding a C# action to a botflow, and how to use the different methods and functions available in the C# action:
- Add a C# action to a botflow: Lists the basic steps needed to add a C# action to a botflow.
- Code method example: Provides an example for using the C# action Code method to add C# code directly to a C# action.
- File method example: Provides an example for using the C# action File method to add C# code saved in a file to a C# action.
- RPAEngine.SetVar example: Provides an example for using the RPAEngine.SetVar function to set Nintex RPA LE variables.
- RPAEngine.GetVar example: Provides an example for using the RPAEngine.GetVar function to get Nintex RPA LE variables.
- RPAEngine.LoadDLL example: Provides an example for using the RPAEngine.LoadDLL function to load a dll at runtime.
Add a C# action to a botflow
To add a C# action to a botflow:
- Start Nintex RPA LE. You can do this from the Start Menu under Nintex or from the Nintex RPA LE shortcut on the Desktop.
- On the Actions list (located under the Selection Tool
), click Advanced and then click C# from the Programming list. The Action Builder window for C# displays.
- Set the C# Action Options/Settings.
- Method: Select a Method from the drop-down list:
- Code: Select Code from the drop-down list to display the Code field.
- File: Select File from the drop-down list to display the File field.
- Timeout: Set the number of seconds in the Timeout field to stop the C# code should it enter an infinite loop and fail to end.
- Code: The Code field displays when you select Code as the Method. Type your C# code into the Code field to
compile and run your C# code as part of the C# action. Or use the Expression Builder (
) to build the action settings using variables or other token values. The C# code is compiled as a temporary .exe file, executed, and then deleted when the botflow run completes.
- File: The File field displays when you select File as the Method. Type the file location into the File field, use the Folder (
) to select the file location, or use the Expression Builder (
) to build the action settings using variables or other token values. The File method works better when you have a large amount of code to execute.
- Save to: It is recommended that you save
the C# action results to a Variable. Select the Save to check box to activate the Save to field. Type the variable name in the Save to field, select the variable from the drop-down list, or use the Expression Builder (
) to build the action settings using variables or other token values. Nintex RPA LE supports C# statement outputs of "Console.WriteLine" or "Console.Write".
- If needed, adjust the Run Switch to add the action without running it.
- Optionally, add an action Note.
- Click OK to add the C# action to the botflow.