A script component lets you add custom C# methods to your solutions for advanced functionality or situations where interrogation or recording isn't possible or sufficient.
You might use this advanced feature when you have existing C# methods you want to
leverage, for example. When you add a script component to a solution and create at
least one method for the script, Pega Robot Studio creates an assembly
Script-identifier.dll) for the script component. This
file, along with the DLL files that are required for any of the other Robot Studio components that generate dynamic
assemblies, are stored in the user's
%LocalAppData% folder. Robot Studio uses these assembly files during project design only.
When you create a runtime deployment package for the project, the dynamic assembly
of the project contains all the required component assemblies.
- In the Project Explorer, click the Globals container.
- In the Toolbox Search field, enter Script.
- Click and drag the Script component to the Automation Surface.
- Right-click the Script component, and then select
Result: The script editor opens, as shown in the following figure:
- Add your custom C# methods, and then click Save.
- Optional: To specify any external assemblies that the code
requires, click Manage references and add the
assemblies.You can add assemblies from any of the following locations:
.NET(GAC or Global Assembly Cache)
PublicAssembliesfolder (in AppData)
- Click Validate to compile the script and test the syntax
of your C# code.
Result: The script editor highlights incorrect syntax so that you can edit the code.