Hello Everyone,
I have a table in my Kintone app that has the following fields:
Table Name = TableA
DROPDOWN = ExistingBC
TEXT = Color
TEXT = Top
TEXT = Description
What I'm trying to accomplish is when I select a value from the DROPDOWN, for example, I select 50001. I want to be able to populate the
Text.Color = "Black"
Text.Top = "Solid"
Text.Description = "Black Plastic Pail with Solid Top"
I get this to work great when I am populating fields that are not in a table. I was using a Switch (Case, Break) code with each BC number to populate the individual fields, but when I try to apply it to a table with the same fields in the table, it will not populate, so I'm thinking I'm missing a step or 2 when it comes to tables. Any thoughts, tips, or suggestions would be very appreciative. Thank you.
(function () {
"use strict";
var DRUMBCNUM = "drop_bc_num";
var DRUMCOLOR = "drum_bc_exist_color";
var DRUMTOP = "drum_bc_exist_top";
var DRUMCOM = "drum_bc_description";
var dropdownEvents = [
"app.record.edit.change." + DRUMBCNUM,
"app.record.create.change." + DRUMBCNUM,
];
kintone.events.on(dropdownEvents, function (event) {
var record = event.record;
var dbcnum = record[DRUMBCNUM].value;
switch (dbcnum) {
case "50001":
record[DRUMCOLOR].value = "Black";
record[DRUMTOP].value = "Closed - Lined";
record[DRUMCOM].value = "N-3 OS Tight Head Drums";
break;
case "50002":
record[DRUMCOLOR].value = "Black";
record[DRUMTOP].value = "Open - Unlined";
record[DRUMCOM].value = "N-2 Open Head Unlined Black";
break;
case "50011":
record[DRUMCOLOR].value = "Black";
record[DRUMTOP].value = "Open - Lined";
record[DRUMCOM].value = "N-4 Open Head (Lined ) Drums";
break;
case "50023":
record[DRUMCOLOR].value = "Blue";
record[DRUMTOP].value = "Closed - Lined";
record[DRUMCOM].value = "N-9 OS -Tight Head Drums - Blue";
break;
case "50026":
record[DRUMCOLOR].value = "Red";
record[DRUMTOP].value = "Closed - Lined";
record[DRUMCOM].value = "Tight Head Drums - Orange ENEOS Brand";
break;
default:
record[DRUMCOLOR].value = "";
record[DRUMTOP].value = "";
record[DRUMCOM].value = "";
}
return event;
});
})();