If this valid? I am trying to include && c...
# suitescript
m
If this valid? I am trying to include && check inside a switch block. Previously I only needed to check for brand_type so _*case brand_type == "1"*_ was fine. Now I need to also check the subsidiary. I also tried to switch (brand && subsidiary) it always hits the default
Copy code
if (brand_type) {
                switch (brand_type) {
                    case brand_type == "1" && subsidiary == "2":
                        document_id = 123;
                        break;
                    default:
                        document_id = 521; //Default
                        break;
                }
            }
l
you can do that like this: var test1 = 10; var test2 = 20; switch(test1,test2) { case 10,20: alert('OK'); break; default: alert('false'); }
👌 2
switch(brand_type, subsidiary) case "1", "2":
m
Amazing, that works - thanks!