How to specify contains in client script for multi-value list field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2017 10:13 AM
Hi guys, we are introducing a multi-select 'Impacted regions' field to our INC form (on a Major Incident tab).
Currently we have a script that sets e-mail recipients based on the Priority and a Customer field 'Member field' (which is a one value field).
We will want to update this client script off of the Impacted regions field (also on the INC form) instead of Customer Member firm so my question is how can we update it e.g. how can I specify 'contains' in the below example instead of == where the Newvalue could be up to 5 values and not just one?
if((newValue == 'TESTMEMBERFIRM') && (priority == 7)){
g_form.setValue('u_to', 'test@test.com');
}
In other words how could I say newValue contains 'USA' and 'Canada' - I'm not sure how the values in a multi-select list field are parsed.
Many thanks in advance,
DS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:24 AM
If not is my syntax all OK?! Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:24 AM
Try changing your script to:
var pr = g_form.getValue('priority');
var priority = parseInt(pr);
alert("Priority = " + priority + " regionList: " newValue);
See if those fields are populated and match the values of what you are looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:31 AM
Thanks Michael, I put this as a new line:
alert("Priority = " + priority + " u_impacted_regions: " newValue);
but am seeing this error so cannot save.
Could not save record because of a compile error: JavaScript parse error at line (4) column (67) problem = missing ) after argument list (<refname>; line 4)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:32 AM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var pr = g_form.getValue('priority');
var priority = parseInt(pr);
alert("Priority = " + priority + " u_impacted_regions: " newValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:44 AM
Arg forgot a + sign. Try the following:
alert("Priority = " + priority + " u_impacted_regions: " + newValue);