I tried both
.on('initSubmit', async function( e, a ) {
map = await teamNameMap()
team_id = editor.field('system_name').val()
team_name = map[team_id]
editor.field('subsystem').val(team_id)
editor.field('system_name').val(team_name)
editor.field('api_token').val(Math.random(1) * 100)
})
and
.on('preSubmit', async function( e, o, a ) {
console.log(e)
data = o.data[Object.keys(o.data)[0]]
data.subsystem = data.system_name
let map = (await teamNameMap())
data.system_name = map[data.subsystem]
data.api_token = "cheese"
o.data = data
})
and neither seem to be affecting the data that gets sent to the server, afaics from dev console