If condition

Jeni Sebastian
Mega Contributor

Hi everyone!

I would like to ask how to write a script for the condition :

If account field contains "OOO" and if account field does not contain "NA"

 

Here's what I did :

var str = current.getValue("u_account");
    if((str.contains("OOO")) && (str.doesnotcontain("NA"))){

 

But it seems like it doesnt work for the "&& (str.doesnotcontain("NA"))"  

Thank you in advance!

 

1 ACCEPTED SOLUTION

Here is another option:

var string = current.getValue("u_account");
if((string.contains('OOO'))&&(!string.contains('NA'))){
    gs.info('the string contains OOO and does not contain NA')
}

View solution in original post

3 REPLIES 3

Martin Ivanov
Giga Sage
var string = current.getValue("u_account");
if((string.indexOf('OOO')!= -1)&&(string.indexOf('NA')==-1)){
    gs.info('the string contains OOO and does not contain NA'); // replace with your code
}

Please mark Correct and Helpful if my answer helps you resolve your issue. Thanks!
Martin Ivanov
Community Rising Star 2022

Here is another option:

var string = current.getValue("u_account");
if((string.contains('OOO'))&&(!string.contains('NA'))){
    gs.info('the string contains OOO and does not contain NA')
}

Thank you it worked!