- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 06:40 AM
Hi there,
Currently I have a form linked to a record producer. On this form there are several checkboxes, all associated with a different external e-mail address. When any of these checkboxes are "checked off" (value = true), I want to append the related e-mail address to the watch list of the task.
I have the logic working to add the e-mail addresses to the watchlist when a single checkbox is checked, however when multiple checkboxes are checked off, it seems to only add 1 of the e-mail addresses (whichever is the last one in the order to run).
I tried modifying the code from an = to a += to show: current.watch_list += "abc@xyz.com", however when I do that, it adds a 'single' email address with all the e-mails concatenated together.
My Question: How do I modify this code, so when multiple checkboxes on the portal form are checked, each e-mail address associated with each checkbox will add to the current watchlist? (each checkbox has only 1 associated e-mail address)
code below which lives in the script section on the record producer:
// this script will add the e-mail address to the watchlist, ONLY if 1 checkbox is selected. If multiple checkboxes = true, then only the latest if statement will work.
//(ex. if checkbox1 is the only box checked, abc@xyz.com will be added to the watchlist, but if checkbox1 and checkbox2 are both checked, only def@xyz.com will be added.)
if(producer.checkbox1_observer == "true"){
current.watch_list="abc@xyz.com";
}
if(producer.checkbox2_observer == "true"){
current.watch_list="def@xyz.com";
}
if(producer.checkbox3_observer == "true"){
current.watch_list="ghi@xyz.com";
}
if(producer.checkbox4_observer == "true"){
current.watch_list="jkl@xyz.com";
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 06:44 AM
The watch list is expecting a comma separated list of values, so I would push all the values to an array and then set that to the watch list like this:
var emailArr = [];
if (producer.checkbox1_observer == "true") {
emailArr.push("abc@xyz.com");
}
if (producer.checkbox2_observer == "true") {
emailArr.push("def@xyz.com");
}
if (producer.checkbox3_observer == "true") {
emailArr.push("ghi@xyz.com");
}
if (producer.checkbox4_observer == "true") {
emailArr.push("jkl@xyz.com");
}
current.watch_list = emailArr.join();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 06:44 AM
The watch list is expecting a comma separated list of values, so I would push all the values to an array and then set that to the watch list like this:
var emailArr = [];
if (producer.checkbox1_observer == "true") {
emailArr.push("abc@xyz.com");
}
if (producer.checkbox2_observer == "true") {
emailArr.push("def@xyz.com");
}
if (producer.checkbox3_observer == "true") {
emailArr.push("ghi@xyz.com");
}
if (producer.checkbox4_observer == "true") {
emailArr.push("jkl@xyz.com");
}
current.watch_list = emailArr.join();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 06:57 AM
worked like a charm! Thanks Brad, and for the speedy reply as well!