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

Thank-you Michael, I look forward to trying this out soon - I'm on leave for a few days now.



I presume creating the sys property is straight-forward. Talk soon, many thanks, Daniel


Yes you can type "sys_properties.list" in your Filter navigator and then click New in there.   Just name it something that makes sense to you and then update the code.



Have an enjoyable leave.


In terms of specifiying an e-mail basically I need a way of saying if all regions send to a global e-mail address so I was wondering about doing this on character length found?



Basically I need to set e-mail addresses like below:



If Priority = P1 (i.e., major incident):



If Service Regions includes


Set u_To as


All regions (you could just check length of string or look for 4 commas?)


Global email address


ELSE



Australia


Aus email


Canada


Canada email


EMEA


Emea email


South Africa


South Africa email


USA


Usa email


AND THEN always add


Misc email


You should be able to do this in the email notification instead, which I assume you are using to send the email?   You can insert a mail script to check the lengh and change the To email.


Hi - We're using an e-mail client template for the content of the e-mail itself.