Script Mapping

Updated by Luka Koczorowski

Script Mapping

In some scenarios, when Mapping Custom Actions or DLL Invocations a user may instead want to map those actions to inline scripts

Supported Languages

The following language are supported:

Target RPA Platform

Supported Languages

Power Automate Desktop

  • VBScript
  • JavaScript
  • PowerShell
  • Python
  • VB.NET
  • C# .NET
  • Robin Script

Map a Script

Using Rules Dashboard

Custom Actions Rules dashboard is currently mostly read-only. The only available functionality is to enable rules or bulk delete rules.

Using CSV

  1. Export CSV

To start using the CSV Rules sheet, the user must export the Rules table to CSV. To do so, from the Rules dashboard, click Advanced -> Export Rules to CSV

The following columns will be auto-populated by Blueprint's Rule Generator:

  • Column A ("ScopeId") = Scope for Rule. Blank implies Instance level
  • Column B ("SourceActionType") = CUSTOM_ACTION
  • Column C ("TargetActionType") = EXTERNAL_FLOW
  • Column E ("SourceObjectName")  = Custom Activity Namespace
  • Column G ("SourceActionName")= Custom Activity Method Name
  • Column N ("SourceParameterName") = Name of Parameter
  • Column R ("TargetParameterName") = Same as SourceParameterName
  • Column Y ("IsActive") = FALSE
A row will exist for every parameter. For example, a call to CustomActivity.Add(NumOne, NumTwo) will create two rows, one for parameter NumOne, and another for parameter NumTwo
  1. Configure Rules

Update the following columns

  • Column C ("TargetActionType")

Set this column to one of: RUN_VBSCRIPT, RUN_JAVASCRIPT, RUN_POWERSHELLSCRIPT, RUN_PYTHONSCRIPT, RUN_CSHARPDOTNETSCRIPT, RUN_VBDOTNETSCRIPT, RUN_ROBINSCRIPT

  • Column X ("DefaultValue")

Set this column to your described script. Scripts can be single or multi-line.

When writing Robin Script, you can reference the original source parameters. Read below for more details
  1. Import Rules CSV

To import rules, from the Rules dashboard, click Advanced -> Import Rules From CSV

Referencing Source Parameters with RUN_ROBINSCRIPT

To allow for dynamic, contextualized robin script Blueprint has the ability to reference the source activities parameters using our special { } notation.

Example

Let's imagine we have a custom activity in UiPath that calculates the modulo of a given number by another and we are exporting to PAD

  • Activity Name: Mod
  • Input 1: Num
  • Input 2: DivideBy
  • Output: Remainder

It would look like this:

<Mod Num="MyNumber" DivideBy="MyDivider" Remainder="MyResult">

Since PAD supports modulo, we can replace this custom activity directly with robin script. However, we cannot simply export Num, DivideBy, and Remainder, as these parameters will be different depending in what context our Modulo activity is being used. In our example, Num is MyNumber but for another bot it could be MyNominator, or MyNumbers("Nominator"). To specify where to put the bot specific inputs and outputs, we use Blueprints {parameter} notation. To convert our example, we would use the following as our script:

SET {Remainder} TO {Num} mod {DivideBy}

Then when our example is exported, it will export as the following:

SET %MyResult% TO %MyNumber% MOD %MyDivider%


How did we do?