File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
UX Data Broker Transform/create-update-user-preference Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * This data broker creates or updates a user preference of the given name with the given value
3
+ * @param {{name: string, value?: string} } inputs inputs from the properties field above
4
+ */
5
+ function transform ( { name, value } ) {
6
+ const lib = "Data Broker" ;
7
+ const func = "Create/Update User Preference" ;
8
+ try {
9
+ if ( ! name ) throw new Error ( "Missing required param 'name'" ) ;
10
+
11
+
12
+ gs . getUser ( ) . savePreference ( name , value ) ;
13
+ } catch ( e ) {
14
+ gs . error ( `${ lib } ${ func } - ${ e } ` ) ;
15
+ throw new Error ( e ) ;
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Make sure to select that this data broker mutates data
21
+ * Input this in the properties field:
22
+ *
23
+ [
24
+ {
25
+ "name": "name",
26
+ "label": "Name",
27
+ "description": "The name of the user preference to create or update",
28
+ "readOnly": false,
29
+ "fieldType": "string",
30
+ "mandatory": true,
31
+ "defaultValue": ""
32
+ },
33
+ {
34
+ "name": "value",
35
+ "label": "Value",
36
+ "description": "The value to store in the user preference",
37
+ "readOnly": false,
38
+ "fieldType": "string",
39
+ "mandatory": false,
40
+ "defaultValue": ""
41
+ }
42
+ ]
43
+ */
You can’t perform that action at this time.
0 commit comments