Workflow and ServiceDesk Community

 View Only

Workflow - Tokens from Listbox 

Jun 10, 2015 03:01 PM

 
In this article I will show you how to use Javascript in the Forms (Web).png 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”
 
Web Form Editor (js).png
 
Web Form Editor - Edit Component - Functionality (js).png
 
Add some Tokens to the Listbox Items.
  • Token1
  • Token2
  • Token3

Then add a “Custom Event” using the “AttributesKeyValuePair”.
 
Web Form Editor - Edit Component (Listbox) - Functionality (js).png
 
Choose “onclick”
 
Web Form Editor - Edit Component (Listbox) - Functionality - onclick (js).png
 
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 + '}';
 
Web Form Editor - Script (js).png
 
Open the Form.
Now click on a Token and it will add it to your textbox.
 
Form (js).png
 
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)”
 

Protirus.png

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.