Using record.submitFields can I use a variable to ...
# suitescript
n
Using record.submitFields can I use a variable to specify the ID half of the value pair. This works for me:
var result = record.submitFields({
type: record.Type.ASSEMBLY_ITEM,
id: idRecord,
values: {
custitem_myfield1: newValue
}
});
but this does not:
var recField = 'custitem_myfield1'
var result = record.submitFields({
type: record.Type.ASSEMBLY_ITEM,
id: idRecord,
values: {
recField: newValue
}
});
b
n
thanks
m
Like battk said, you can in SS2.1, if you still need to use 2.0 for whatever reason you can do it like so
Copy code
var recField = "custitem_myfield1";
var values = {};
values[recField] = newValue;

var result = record.submitFields({
  type: record.Type.ASSEMBLY_ITEM,
  id: idRecord,
  values: values,
});
👍 1
🙌 1
1