Using the Run function action

Use the Run function action to run a function within a .dll file and specify the parameters to pass a function and store the output as a variable.

  • This action enables you to pass a parameter of any type.
  • The Run function action does not support the use of Windows Forms.
  • If the .dll file uses .NET functions or classes from another .dll file, you must add the second .dll file as a manual dependency of the bot.

    Bot dependencies

  • This action supports overloaded functions starting from Enterprise A2019.17. The action can handle .dll files that contain multiple functions of the same name. It calls the function based on the number of parameters passed.
  • When you use this action, ensure that you use the supported data types for DLL functions.

    DLL package

Procedure

Perform the follow steps to run a function:

  1. In the Actions palette, double-click or drag the Run function action from the DLL package.
  2. In the Session name field, enter the name of the session.
  3. In the Enter the namespace (Optional) field, specify the namespace.
    You can specify any of the namespaces defined in the DLL file.
    Note: Ensure that the value you have provided in the field is correct.
    Important: This field is case-sensitive.
  4. In the Enter the class name field, specify the name of the class.
    You can specify the name of any of the classes available in the namespace.
    Important: This field is case-sensitive.
  5. In the Enter the name of function to be executed field, specify the name of the function to execute.
    Ensure that the name you have provided is correct and available in the class specified in the previous step.
    Important: This field is case-sensitive.
  6. Optional: In the Input parameters section, click the Add Parameters button.
    1. In the DLL parameter details dialog box, in the Parameter name field, enter the name of the parameter.
    2. From the Parameter type list, select a data type.
      For Integer data type (UInt16, Int16, Int32, Int64, Int, Single, Float, Decimal, Double, UInt32, or UInt64), you can use a value from a credential vault or a credential variable as input parameter.
    3. In the value field, enter the value that you want to pass .
      If you select the Integer data type, you can choose from the following options:
    • Number: In the number field, enter the value that you want to pass.

    • Credential: To use a value from a credential vault, select Credential. To use a credential variable, select Variable.
    For more information about credential vaults and how to use them, see Credentials and lockers in the Credential Vault.
    Repeat Step 6 to add multiple parameters.
    Important: The names of the parameters you add and their order must be the same as in the DLL function.
  7. Use the Run function in background option when no Windows system-related operations, such as such as keystroke, mouse click, or window switching, are called under the C# DLL. You can select the Run function in background check box to bypass the intermediate window (AAZeroSizeForm) and run the C# DLL under the console application without the form. We recommend that you select this check box if the DLL function is not interacting with the Windows API to perform operations such as keystroke, mouse click, or window switching. This feature also helps to improve the performance of the DLL execution if the Run function in background check box is selected.
  8. Optional: In the Assign output to variable list, select a variable to use to store the output of the function.
    You can use Boolean, datetime, dictionary, list, number, string, or table variable types to store the output based on the type of output the function returns.
  9. Click Save.