#blackhawkjag

1 messages · Page 1 of 1 (latest)

forest bobcatBOT
dusky ferry
#

Hi there

brisk ice
#

Hello!

dusky ferry
#

So you want to dynamically set custom_fields and you are looking to map an array to these custom fields?

brisk ice
#

Exactly

dusky ferry
#

And you want each different "name" to have a different "label"?

#

Or you want just one label?

brisk ice
#

So each label would be the unique item in the array. The value can be the exact same. I.E ["jim", "ted"] would end up {label: "jim", value: '"jim}, {label: "ted", value:"ted"}

dusky ferry
#

Ah okay

#

So you want to map to an array of objects where you duplicate the value of the array as both the key/value pair for the object

brisk ice
#

yes

dusky ferry
#

Gotcha then I think what you want to do is just loop through your array and create an array of objects where you add a new object each time to the new array

brisk ice
#

ok, so when i make that new array of objects outside of the scope. Can i just do custom_fields: [ { key: 'dogs', label: {type: 'custom', custom: 'Which dog are you buying VIP for?'}, optional: false, type: 'dropdown', dropdown: { options: [ {label: 'test1', value: 'test1'} {label: 'test2', value: 'test2'} ] } } ],custom_fields: [ { key: 'dogs', label: {type: 'custom', custom: 'Which dog are you buying VIP for?'}, optional: false, type: 'dropdown', dropdown: { options: [ objectArray ] } } ],?

#

Sorry ```custom_fields: [
{
key: 'dogs',
label: {type: 'custom', custom: 'Which dog are you buying VIP for?'},
optional: false,
type: 'dropdown',
dropdown: {
options: [
objectArray
]
}
}
],

dusky ferry
#

If your new array of objects is set to contain label and value for the key of each pair then yes that should work

brisk ice
#

I just tested it and it works flawlessly. Thank you so much, i really appreciate the help!