setFollower
Sets another Flow to be a follower for the currently active Flow. Once the current Flow finishes, the follower Flow will start immediately and the UI showing the Flow's progress should seamlessly switch to observing the follower. The variable context is, by default, not carried over to the follower, but a Map of external parameters can be defined to carry over a set of values even if the context is refreshed between the Flows.
Do note that this command only "configures" what will happen once the current Flow finishes, therefore not having any immediate effect at the time it is executed. Any Flow step or Screen step will clear this follower setting, though, so this command should be placed between the end of the Flow and the last Flow step or Screen step. Also note that a Flow can have only one follower defined for it, so any setFollower
commands past the first will just overwrite what the previous one defined.
Attributes
resourceProvider | ||
---|---|---|
Required | Value type | EL-evaluated |
No | File | Yes |
The resolved value of this attribute is expected to a be a Dynamo template file that contains the Flow specified with If not defined, the currently active template will be used as this resource provider. |
flowID | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
Defines the ID of the Flow to be run as the follower. The main Flow in most templates is called "compose". |
event | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines an event ID that is given to the follower Flow. If not defined, the given event ID will be an empty string. |
preserveContext | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the currently running Flow's variable context is carried over to the follower Flow. |
params | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Map | Yes |
Defines a Map that will be delivered as external parameters to the follower Flow. The resolved value of this attribute is therefore expected to a be a Map. As other external parameters, this Map can be accessed in the follower Flow with the variable "param". |
Examples
One of the uses for setFollower
is the creation of custom template selection systems. The basic idea is that a Flow, through user input or some other means, selects and loads another Dynamo template file and sets it as the follower.
<choose><when test="${UserInfo.profileId == '00eD0000003PqEEIkC'}"><load var="template" recordId="${specialTemplateId}"><otherwise><load var="template" recordId="${standardTemplateId}"><setFollower resourceProvider="${template}" flowID="compose" event="new" params="${param}">
The above logic would load the "special template" for users with a certain Profile, while loading the "standard template" for others. Once the Flow with this logic finishes - which it could very well do right after setFollower
- the UI will invisibly switch to running the loaded template's Flow. By setting the params
attribute's value to "${param}", all the original external parameter values are available to the follower Flow as well.