Execute Subroutines
Runs a dynamic list of subroutines based on their names, and new routines can be added while the command runs.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
goSubs --routines(List<String>)
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Subroutines | routines |
Required |
List<Text> |
List with the names of the subroutines to run. The name of the subroutine is given when creating it, and the creation process occurs in the following ways:- Select a script command block, in "Design" mode, right-click and go in the option "Advanced > Extract Routine"; - Create a subroutine manually, in "Design" mode, from the "View > Routines > New Routine" menu; or, in "Script" mode, insert the verb of the command "beginSub", insert the instructions and end with the command "endSub". |
Example
Example 1: Creates two subroutines and uses the Add to Collection (add
) command to add both subroutines to a collection and runs the subroutines in the
collection.
defVar --name newSubRoutine --type List --innertype String
add --collection "${newSubRoutine}" --value subRoutineA
goSubs --routines ${newSubRoutine}
beginSub --name subRoutineA
add --collection "${newSubRoutine}" --value subRoutineB
logMessage --message "Execution of subroutine A started." --type "Info"
endSub
beginSub --name subRoutineB
logMessage --message "Execution of subroutine B started" --type "Info"
endSub
Example 2: Creates the subroutines and createas a collection with the names of both subroutines pre-assigned. The command uses the name of both subroutines to run them.
defVar --name subRoutinesList --type List --innertype String --value "[subRoutineA,subRoutineB]"
defVar --name currentDate --type DateTime
goSubs --routines ${subRoutinesList}
beginSub --name subRoutineA
getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
logMessage --message "Current date of subroutine A: ${currentDate}" --type "Info"
endSub
beginSub --name subRoutineB
getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
logMessage --message "Current date of subroutine B:${currentDate}" --type "Info"
endSub