Skip to content

Commit 64c3cef

Browse files
authored
Merge pull request #10376 from alihcsumer/wtf/actionreturnvalues
Return value mapping documentation
2 parents 6e86320 + 4663b17 commit 64c3cef

4 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "Return Value Mapping"
3+
url: /refguide/return-value-mapping/
4+
weight: 60
5+
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
6+
---
7+
8+
## Introduction
9+
10+
In Studio Pro 11.5 and above, 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. In previous versions, modifying values on a page from a microflow or nanoflow require an additional entity passed as a parameter, resulting in many page-specific variations of the same logic.
11+
12+
Return values can be mapped to available variables on a page or snippet. Both primitive and object return value types are supported. By using an expression, the return value can be transformed as needed before assignment.
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.
15+
16+
{{< figure src="/attachments/refguide/modeling/application-logic/microflows-and-nanoflows/return-value-mapping/return-value-mapping-list.png" max-width=80% >}}
17+
18+
## Supported Return Values
19+
20+
Return value mapping supports both primitive values and objects from the microflow or nanoflow return value.
21+
22+
### Supported Primitive Types
23+
24+
The following primitive types can be mapped directly:
25+
26+
* Boolean
27+
* Date and time
28+
* Decimal
29+
* Enumeration
30+
* Integer/Long
31+
* String
32+
33+
### Object Attributes
34+
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.
36+
37+
{{< figure src="/attachments/refguide/modeling/application-logic/microflows-and-nanoflows/return-value-mapping/variable-return-value-mapping.png" max-width=80% >}}
38+
39+
### Lists Not Supported
40+
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.
42+
43+
## Transforming Return Values
44+
45+
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.
48+
49+
{{< figure src="/attachments/refguide/modeling/application-logic/microflows-and-nanoflows/return-value-mapping/expression-return-value-mapping.png" max-width=80% >}}
50+
51+
For example, 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:
52+
53+
```
54+
formatDecimal($ActionReturnValue/TotalAmount, '$#,##0.00')
55+
```
56+
57+
## Page Variable Assignment
58+
59+
Return values can be assigned to various targets available on the page or snippet.
60+
61+
### Available Targets
62+
63+
The following targets are available for return value mapping:
64+
65+
* **Page and snippet variables** – Variables defined on the current page or snippet
66+
* **Page and snippet parameters** – Parameters of the current page or snippet
67+
* **Attributes of objects on the page** – Attributes of objects available in data views or other data containers on the page
68+
69+
### Type Matching
70+
71+
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.
72+
73+
For example:
74+
75+
* A decimal return value can be assigned directly to a decimal page variable
76+
* A decimal return value can be transformed with an expression like `formatDecimal($ActionReturnValue, '#,##0.00')` and assigned to a string page variable
77+
* An object attribute can be extracted and assigned to a matching primitive variable
Loading
11.9 KB
Loading
Loading

0 commit comments

Comments
 (0)