You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/application-logic/microflows-and-nanoflows/return-value-mapping.md
+52-14Lines changed: 52 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,34 +7,72 @@ weight: 60
7
7
8
8
## Introduction
9
9
10
-
Pages and snippets can use [return values](/refguide/end-event/#return-value) when calling microflows or nanoflows by specifying a return value mapping. This feature enhances microflow and nanoflow reusability by allowing pages to update local values based on flow return values without needing to pass objects containing those attributes to the flow.
10
+
Pages and snippets can use [return values](/refguide/end-event/#return-value) when calling microflows or nanoflows by specifying a return value mapping. This feature enhances microflow and nanoflow reusability by allowing pages to decide how to use return values. Previously, modifying values on the page from a microflow or nanoflow required an additional entity passed as a parameter, resulting in many page-specific variations of the same logic.
11
11
12
12
Return values can be mapped to available variables on the page or snippet. Both primitive and object return value types are supported. Using an expression, the return value can be transformed as needed before assignment.
13
13
14
+
You can add more than one return value mapping to the same flow call. This is particularly useful when assigning multiple computed values to different variables from the same return value.
Return value mapping supports both primitive values and objects from the microflow or nanoflow return value.
17
21
18
-
For primitive return values (such as strings, booleans, integers, decimals, or enumerations), the value can be assigned to any matching attribute of available objects on the page, or to variables and parameters of pages or snippets. The target must have a compatible data type with the return value.
22
+
### Supported Primitive Types
19
23
20
-
## Object Return Values
24
+
The following primitive types can be mapped directly:
21
25
22
-
When a microflow or nanoflow returns an object, you can specify a return value mapping using one or more attributes of that object. This capability makes it possible to dynamically update multiple attributes, variables, and parameters with the return value of a single flow.
26
+
* Boolean
27
+
* Date and time
28
+
* Decimal
29
+
* Enumeration
30
+
* Integer/Long
31
+
* String
23
32
24
-
To use multiple attributes from a returned object, add more than one return value mapping to the same flow call. This is particularly useful when assigning multiple computed values to different variables from the same return value.
33
+
### Object Attributes
25
34
26
-
## Mapping Return Values from a Page
35
+
When a microflow or nanoflow returns an object, you can select specific attributes from that object. This allows you to extract individual values from the returned object without needing to work with the entire object on the page.
27
36
28
-
When calling a microflow or nanoflow action, you can map return values in two primary ways.
Variable return value mappings are used to map values returned by the microflow or nanoflow directly. When the flow returns an object, you can select specific attributes from that object to assign to variables on the page or snippet.
41
+
Return value mapping does not support list return values. If your microflow or nanoflow returns a list, you cannot use return value mapping to capture it. In such cases, consider using a different approach, such as passing an object as a parameter or using the list directly in a data source.
You can use expressions to transform return values before they are assigned. In the expression, the return value is available as `$ActionReturnValue`.
46
+
47
+
When the microflow or nanoflow returns an object, you can access attributes using `$ActionReturnValue/AttributeName`. This allows you to apply transformations to attributes, before assigning the value.
If a microflow returns an **Order** object with a **TotalAmount** attribute (Decimal), you can format it as currency before assigning it to a string page variable:
Return values can be assigned to various targets available on the page or snippet.
62
+
63
+
### Available Targets
64
+
65
+
The following targets are available for return value mapping:
66
+
67
+
***Page and snippet variables** – Variables defined on the current page or snippet
68
+
***Page and snippet parameters** – Parameters of the current page or snippet
69
+
***Attributes of objects on the page** – Attributes of objects available in data views or other data containers on the page
35
70
36
-
### Expression-Based Return Value Mappings
71
+
### Type Matching
37
72
38
-
Both primitive values and object attributes can be mapped using expressions. This method allows you to use functions within the expression to modify the return value before it is assigned.
73
+
The target variable or attribute must have a compatible data type with the return value. When using expressions, the result type of the expression must match the target type.
* A decimal return value can be assigned directly to a decimal page variable
77
+
* A decimal return value can be transformed with an expression like `formatDecimal($ActionReturnValue, '#,##0.00')` and assigned to a string page variable
78
+
* An object attribute can be extracted and assigned to a matching primitive variable
0 commit comments