7px
05/31/2024, 3:37 AMrecord.setValue()
to assign a value to a Custom Field that's sourcing from a Custom List with three entries (which have ID values of 1,2, and 3 respectively).
as mentioned trying to assign a value with record.setValue()
doesn't seem to work. I figured it would be an issue with the value I'm assigning, but assigning the text nor the ID value works. I'm not sure if this is a limitation of the function, or maybe I'm missing something?Clay Roper
05/31/2024, 4:08 AM7px
05/31/2024, 6:31 AMparams
through a function part1
and plug them in a Custom Record's form newRec
in Netsuite. For the specific field, I created a similar drop-down list on the HTML form with three options, all `name`'d and `id`'d with 1a, 1b, and 1c respectively, while in Netsuite is a Custom List with three entries with the ID's 1,2, and 3.
function part1(ob, opt) {
let a = ''
for(let x = 0; x < opt.length; x++) {
if(opt[x] in ob) {
a = opt[x].toString();
break;
}
}
return a;
}
//...
let _07_choices = ["1a", "1b" ,"1c"];
let _07_promptness = part1(params, _07_choices);
newRec.setValue({
fieldId: "custrecord_idaud_promptness",
value: _07_choices.indexOf(_07_promptness) + 1].toString()
});
As shown, I attempt to return a number in string format, to no avail. Trying to return it formatted as an int or float doesn't seem to work either, as I keep getting the error:
You have entered an Invalid Field Value -1 for the following field: custrecord_idaud_promptness
I'm not sure where I'm lost or what I'm missing tbh
*edit, typobattk
05/31/2024, 7:22 AMbattk
05/31/2024, 7:23 AMbattk
05/31/2024, 7:24 AMbattk
05/31/2024, 7:25 AMbattk
05/31/2024, 7:26 AMdaz_buildz
05/31/2024, 8:37 AMlet _07_choices = {"1a": 1, "1b": 2, "1c": 2};
then the setValue piece becomes
newRec.setValue({
fieldId: "custrecord_idaud_promptness",
value: _07_choices[param]
});
interested to know if that bypasses the problematic bits