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
// This document is subject to the terms of the Creative Commons Attribution 4.0 International license.
4
4
// If a copy of the license was not distributed with this
@@ -121,17 +121,18 @@ which returns an object containing the following fields :
121
121
122
122
- valid (_boolean_) : true if the user input is valid
123
123
- errorMsg (_string_) : message in case of invalid user input. If valid is true this field is not necessary.
124
-
- responseCardData (_any_) : the user input to send in the data field of the child card. If valid is false this field is not necessary.
125
-
- responseState : name of the response state to use. This field is not mandatory, if it is not set the state defined in
124
+
- responseCard:
125
+
* data (_any_) : the user input to send in the data field of the child card.
126
+
* state : name of the response state to use. This field is not mandatory, if it is not set the state defined in
126
127
`config.json` will be used for the response.
127
-
- publisher (_string_) : the id of the Entity to be used as publisher of the response. This field is not mandatory, if it is not set the publisher will be the user entity, in case the user belongs to a single entity, or it will be choosen by the user between his available entities.
128
-
- actions (_string array_) : an optional field used to define a set of predetermined actions that will be executed upon receiving the response card. The available actions include:
129
-
* PROPAGATE_READ_ACK_TO_PARENT_CARD : when receiving the child card, the status of the parent card should be considered as 'unread' and 'not acknowledged' until the user reads or acknowledge it again.
128
+
* publisher (_string_) : the id of the Entity to be used as publisher of the response. This field is not mandatory, if it is not set the publisher will be the user entity, in case the user belongs to a single entity, or it will be choosen by the user between his available entities.
129
+
* actions (_string array_) : an optional field used to define a set of predetermined actions that will be executed upon receiving the response card. The available actions include:
130
+
** PROPAGATE_READ_ACK_TO_PARENT_CARD : when receiving the child card, the status of the parent card should be considered as 'unread' and 'not acknowledged' until the user reads or acknowledge it again.
130
131
131
132
132
133
This method is to be registered via `opfab.currentCard.registerFunctionToGetUserResponse`, the method will be called by OperatorFabric when the user clicks on the button to send the response.
133
134
134
-
In the example below, the `getUserResponse` creates a `responseCardData` object by retrieving the user's inputs from the HTML.
135
+
In the example below, the `getUserResponse` creates a `responseCard` object by retrieving the user's inputs from the HTML.
135
136
In addition, if the user chose several options, it overrides the response state defined in the `config.json` with another
The function returns a `Promise<void>`. The promise will be resolved when the response is sent and rejected with an error message if an error occurs.
727
727
728
728
The `parentCard` parameter is the parent card object (can be obtained from the current card object).
729
729
730
-
The `responseData` object has the following fields:
730
+
The `responseCard` object has the following fields:
731
731
732
-
- `responseCardData`: The data field to include in the response card.
732
+
- `data`: The data field to include in the response card.
733
733
- `actions`: The actions field value for the response card. This field is optional.
734
-
- `responseState`: The state field value for the response card. This field is optional (default value is defined in the state process definition).
734
+
- `state`: The state field value for the response card. This field is optional (default value is defined in the state process definition).
735
735
- `publisher`: The publisher field value for the response card. This field is optional (default value is the first current user entity that is allowed to respond).
Copy file name to clipboardexpand all lines: src/docs/asciidoc/reference_doc/ui_customization.adoc
+3-3
Original file line number
Diff line number
Diff line change
@@ -435,7 +435,7 @@ To do this, add a `responseButtons` array to the custom screen object. Each butt
435
435
- `getUserResponses: A function that takes an array of cards as a parameter and returns an object containing the following fields:
436
436
- `valid`: A boolean indicating if the action is valid.
437
437
- `errorMsg`: An error message to display if the action is not valid.
438
-
- `responseCards`: An array of response cards to send with the following structure with a `responseCardData` field containing the response card data field.
438
+
- `responseCards`: An array of response cards to send with a `data` field containing the response card data field.
Copy file name to clipboardexpand all lines: src/docs/asciidoc/resources/migration_guide_to_4.7.adoc
+38
Original file line number
Diff line number
Diff line change
@@ -11,3 +11,41 @@
11
11
12
12
A new setting to activate or not the templating of emails has been added in the settings screen of the user.
13
13
This setting can be hidden in the configuration file of the web-ui by the field "settings.settingsScreen.hiddenSettings" by adding the value "disableCardContentInEmails".
14
+
15
+
16
+
== Response card
17
+
18
+
The object that should be returned by the method registered via `opfab.currentCard.registerFunctionToGetUserResponse` is to be changed.
19
+
20
+
Previously, the object was structured as follows:
21
+
22
+
----
23
+
{
24
+
valid: true/false,
25
+
errorMsg: string,
26
+
responseCardData: string,
27
+
responseState: string,
28
+
publisher: string,
29
+
actions: [string]
30
+
}
31
+
----
32
+
33
+
Now, all elements related to the response card are encapsulated within a `responseCard` object:
34
+
35
+
----
36
+
{
37
+
valid: true/false,
38
+
errorMsg: string,
39
+
responseCard: {
40
+
data: string,
41
+
state: string,
42
+
publisher: string,
43
+
actions: [string]
44
+
}
45
+
}
46
+
----
47
+
48
+
Note that the `responseState` field has been renamed to `state`.
49
+
50
+
The old structure will be supported as a fallback for a limited time, it is recommended to update your code to use the new structure.
Copy file name to clipboardexpand all lines: src/test/resources/bundles/defaultProcess_V1/template/question.handlebars
+9-7
Original file line number
Diff line number
Diff line change
@@ -96,12 +96,14 @@
96
96
97
97
constresult= {
98
98
valid:true,
99
-
responseCardData: responseCardData
99
+
responseCard:{
100
+
data: responseCardData
101
+
}
100
102
};
101
103
102
104
// If the user chose several options, we decide to move the process to a specific state, for example to ask a follow-up question (what's their preferred option).
if (choiceRequiresFollowUp) result['responseState'] ='multipleOptionsResponseState';
106
+
if (choiceRequiresFollowUp) result.responseCard['state'] ='multipleOptionsResponseState';
105
107
106
108
return result;
107
109
@@ -162,15 +164,15 @@
162
164
(key in responseCardData) ? responseCardData[key].push(value) : responseCardData[key] = [value];
163
165
}
164
166
165
-
constresult= {
166
-
responseCardData: responseCardData
167
-
};
167
+
constresponseCard= {
168
+
data: responseCardData
169
+
}
168
170
169
171
// If the user chose several options, we decide to move the process to a specific state, for example to ask a follow-up question (what's their preferred option).
Copy file name to clipboardexpand all lines: ui/main/src/app/builtInTemplates/message-or-question-list/card/message-or-question-listCardTemplateView.spec.ts
it('GIVEN input is "my response" and "Yes" WHEN get user response THEN responseCardData.comment is "my_response", responseCardData.agreement is "Yes" and response is valid',()=>{
46
+
it('GIVEN input is "my response" and "Yes" WHEN get user response THEN responseCard.data.comment is "my_response", responseCard.data.agreement is "Yes" and response is valid',()=>{
Copy file name to clipboardexpand all lines: ui/main/src/app/builtInTemplates/message-or-question-list/card/message-or-question-listCardTemplateView.ts
0 commit comments