In this article I will show you how to use Javascript in the Forms (Web) Project Type to pass values from a Listbox to a Textarea.
This is similar to how the Email Templates work in ServiceDesk.
Add a Form Builder component to the Workflow.
Add a Multiline Textbox to your Form. Name it “Email_HTML”
Add a Listbox to your Form, give it an Ouput of “Token_SEL”
Add some Tokens to the Listbox Items.
- Token1
- Token2
- Token3
Then add a “Custom Event” using the “AttributesKeyValuePair”.
Choose “onclick”
Add the following code:
var Email_HTML = document.getElementById("Email_HTML");
var Tokens = document.getElementById("Tokens");
var selectedValue = Tokens.options[Tokens.selectedIndex].text; //.value;
Email_HTML.value = Email_HTML.value + ' ${' + selectedValue + '}';
Open the Form.
Now click on a Token and it will add it to your textbox.
In your code you can now parse the Tokens and replace them with any other info.
You could use “Workflow - Tag Finder (Extract Text By Pattern)”