ドロップダウンの選択項目によって別のフィールドを表示したい

初歩的な質問で恐縮ですが、どうすれば動作するのかご教示いただけないでしょうか?

「test」というドロップダウンフィールドがあり、選択肢にA・B・C・Dがあります。その中のAとBを選択した場合のみ、「other」というドロップダウンフィールドを表示させたいです。(CとDを選択したら「other」は非表示のままにしたい)

(function() {
"use strict";

//レコードの追加、編集、詳細画面で適用する
var events = ['app.record.detail.show',
'app.record.create.show',
'app.record.create.change.test',
'app.record.edit.show',
'app.record.edit.change.test'];

kintone.events.on(events, function(event) {
var record = event.record;
var test = record['test'].value;

if(test == 'A'){
kintone.app.record.setFieldShown('other',true);
}else{
kintone.app.record.setFieldShown('other',false);
}
  if(test == 'B'){
kintone.app.record.setFieldShown('other',true);
}else{
kintone.app.record.setFieldShown('other',false);
}
});
})();

最後のif文で、if(test == ‘B’)でなければ、全ての場合で非表示になっているので、

最初のif文の判定で、AまたはBとしてはいかがでしょうか。

if (test == 'A' || test == 'B') {
    kintone.app.record.setFieldShown('other', true);
} else {
    kintone.app.record.setFieldShown('other', false);
}

PVさん

ありがとうございます!ご教示どおり設定したら動作しました。

とても助かりました!