Create a form for a decision template
How to create a form for a decision template without using code (Sitecore Personalize).
To further enable marketers to configure a decision without using code, technical users can create forms for the marketer to complete, without ever having to edit JavaScript.
When the marketer edits the decision on the decision canvas, the form displays. The marketer simply has to complete the form to configure the decision.
To add configurable parameters to a decision template:
In the JavaScript editor, add the template parameter syntax to the JavaScript:
let nameParam = `[[parametername | type | value1 | {config1: value1, config2: value2 } ]]`;
The following table contains descriptions of the template parameter elements that you can add to a decision template form for a marketer to complete:
Element | Description | Required/optional |
---|---|---|
| The name of the form field that the marketer sees when they create a decision based off this decision template. For example, Fare Class. | Required |
| The type of form field that determines whether the marketer enters text, a number, selects from a drop-down list, and so on. Options are: string, text, number, enum. | Required |
| The default value that displays in the form field for the marketer to confirm or select from a drop-down list. | Optional |
| The order in which the parameter field displays on the form. This element can be used with all the template parameters. | Optional |
| A JSON configuration object that contains name/value pairs, in relation to the type you selected. | Optional |
Caution
If you anticipate that business users might want to add the same decision template more than once to the same canvas, they must change the name of the parameters to be unique so the entered values on one form do not overwrite the entered values on another form. This only applies if the forms are in the same decision model variant.