The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to specify contains in client script for multi-value list field

jas101
Tera Expert

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

29 REPLIES 29

If not is my syntax all OK?! Thanks a lot.


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.


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)


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    var pr = g_form.getValue('priority');


var priority = parseInt(pr);


alert("Priority = " + priority + " u_impacted_regions: " newValue);


Arg forgot a + sign.   Try the following:


alert("Priority = " + priority + " u_impacted_regions: " + newValue);