I am trying to replace a text string depending on ...
# suitescript
d
I am trying to replace a text string depending on a field that has 3 variations? ${record.shipaddress?replace("10 DC Example", "Test Industries OH")} ${record.shipaddress?replace("30 OC Test", "Test Inc MN")} ${record.shipaddress?replace("40 AC Case", "Test Co NY")} Any advice on how to do this using a conditional statement?
d
idk the full context or what your condition is, but seems like opportunity to use
switch
statement potentially
👍 1
j
Are there only those three options?
Copy code
var altered = unaltered == '10 DC Example' ? 'Test Industries OH' : unaltered == '30 OC Test' ? 'Test Inc MN' : 'Test Co NY';
🙌 1