Blog
Read the latest blogs
Find tutorials, guides and use case examples in the
Learning center
The C# Code building block can be used to perform custom logical operations which are not directly available with the regular LEAPWORK building blocks, such as parsing a JSON object, reading values from xml, etc. The C# Code building block comes in handy for coders who want to handle their specific scenarios by relying on programming. Fully expanded, the C# Code block shows the following properties:
Clicking this field opens up a popup which is an editor for C# code. A sample code snippet is also available which shows the entry point for code to be written. Write your code in this editor and press “Run” button to compile and execute it.
Add any number of fields that can contain dynamic content and be used as tokens. This is maintained in the form of Dictionary<string, object> These fields can be collected and typecast for their usage in C# code as required.
The error occurred is an alternate flow which is triggered if there’s any runtime error detected during case execution.
The maximum time allowed for executing the code including the provided input and processing output. It triggers the “Error occurred” connector if the execution is unsuccessful within the specified time.
If the 'Default Timeout' property checkbox is not selected, then the timeout value is 60 seconds. If the 'Default Timeout' property checkbox is selected, then the 'Default timeout' value selected in the flow settings will be applicable.
Note: All cases have a “global timeout” that can be configured in the “Settings” panel. This is unrelated to the timeout of a single building block. However, a running case will automatically be cancelled if it runs for longer than the global timeout.
©2024, Leapwork. All rights reserved.