The values property in submitFields is an array of...
# suitescript
r
The values property in submitFields is an array of values so it should be
[{entity:v_customer},{v_field:v_customer}]
s
Thanks for the info but it's not exactly what I meant. Sorry.
I want v_field = customer. Sometime v_field will be "Entity" Sometime v_field will be "customer_list" Sometime v_field will be "Vendor" Sometime v_field will be "Vendor list" it's the part on the left that is variable
I'm wondering if it's possible
e
values
is not an Array, it is an Object
If you are submitting multiple values, you have an Object with multiple key-pairs
To address your question, do something like this:
Copy code
var myValues = {};
var key = /* populate this with the appropriate key name */;
myValues[key] = theNewValue;

r.submitFields({
  ...
  values: myValues
});
This is for SS2.0. There's a nicer way to do dynamic key names if you're using SS2.1
s
thanks a lot. I have to look at SS2.1
s
if you use this all the time I would do what eric is suggesting, make a function where i pass in the field name, and the value(s) as parameters. MyUpdateField(fieldname, value), to update a field call MyUpdateField("Entity", value). you will need to add some logic to validate the values are appropriate for field name though.