Custom formula editor
The Custom formula editor helps to define complex calculations in Medallia Experience Cloud. The editor provides several tools to ease working with the following:
- Mapping a constant value by default to a Medallia field or to a custom filter.
- Mapping additional metadata values to Medallia fields.
- Transforming the data where necessary.
-
The canvas — This is where you write the actual code, constant value, or where you insert the incoming field. It offers the following:
- Syntax highlighting.
- Inline warnings and errors appear on the side of your code without needing to run it.
- Code quick tests.
-
Test section — Shows a JSON payload based on the formula that can be edited to insert sample values.
-
Result section — This is where the result of the test is displayed.
Close the editor at any time by pressing Esc.
Creating a custom formula
Add constant values, incoming fields and functions to the canvas.
For example, to map a constant value, write it in the canvas and click Save.
+ Function opens a dialog showing what functions and methods are available and where you can select one to add it to the code. You can chain multiple functions together in a formula.
Available functions are Excel-like expressions similar to Formula fields, but they have additional capabilities:
-
Ability to use traditional Excel functions:
-
Ability to access elements inside arrays and nested objects:
-
Built-in type checking mechanism to ensure that the expression is valid using the schema of the information brought by the external system:
-
Ability to build complex expressions to filter data within arrays:
Note: All examples above use the schema used by Genesys Call Center.
+ Incoming Field opens a dialog showing what fields are available, and where you can select one to add it to the code. You can use multiple fields in the same formula.
Experience Cloud automatically tests your code and shows warnings or error messages if the formula is not well formatted. Use this to debug complex calculations.
There are different levels of validation:
-
Lexical validation — Checks that each token is valid according to the rules. A typical error of this kind is when you forget to escape a character.
-
Syntactic validation — Checks that expressions follow the proper syntax. A typical error of this kind is when parentheses are opened, but not closed.
-
Semantic validation — Checks that types are valid across all the expressions and that formulas and fields are valid. A typical error of this kind is when you try to add a number to a string, or when the number of arguments for a given function is not correct.
Running tests
When working with formulas, your code is automatically executed as long as it does not contain any warning or errors. You can also trigger a manual execution.
The test pane shows a JSON based on the formula defined in the canvas pane. Insert sample values into the payload to test the formula and click Test on the bottom margin.
Test results are displayed in the Test section. Click Save to save changes to the custom formula and go back to the connector editor or the data filter screen.
